def selinux_enforcing():
 cmdresult = run('getenforce', ignore_status=True, verbose=False)
 mobj = re.search('Enforcing', cmdresult.stdout)
 return (mobj is not None)

def selinux_enforcing ( ) : cmdresult = run ( 'getenforce' , ignore_status = True , verbose = False ) mobj = re . search ( 'Enforcing' , cmdresult . stdout ) return ( mobj is not None )
returns true if selinux is in enforcing mode .