To query whether or not the defaultRenderGlobals node has been modified since the last file save, use ls -modified. To force the scene to be dirty/clean use file -modified In query mode, return type is based on queried flag.
Derived from mel command maya.cmds.checkDefaultRenderGlobals
Example:
import pymel.core as pm
# pm.checkDefaultRenderGlobals(q=1, changed=1) can be replaced with a call to the ls command
# To check if the defaultRenderGlobals node is marked dirty or not, do this:
if( 'defaultRenderGlobals' in pm.ls(modified=1) ):
# do something...
pass
# To mark the entire scene dirty.
pm.file( modified=1 )
# To mark the entire scene clean
pm.file( modified=0 )