Check if device is under Mobile Device Management?

Is there a way to check in code if a device is under Mobile Device Management? We want to show the users a different screen in the app if it is under device management. This is primarily for devices under Apple School Manager or something similar

sudo profiles show -type enrollment

Check if device is under Mobile Device Management?
 
 
Q