def validate_enabled(enabled):
 if isinstance(enabled, str):
  if (enabled.lower() not in ['on', 'off', 'yes', 'no']):
   msg = "\nMac Power: Invalid String Value for Enabled.\nString values must be 'on' or 'off'/'yes' or 'no'.\nPassed: {0}".format(enabled)
   raise SaltInvocationError(msg)
  return ('on' if (enabled.lower() in ['on', 'yes']) else 'off')
 return ('on' if bool(enabled) else 'off')

def validate_enabled ( enabled ) : if isinstance ( enabled , str ) : if ( enabled . lower ( ) not in [ 'on' , 'off' , 'yes' , 'no' ] ) : msg = "\nMac Power: Invalid String Value for Enabled.\nString values must be 'on' or 'off'/'yes' or 'no'.\nPassed: {0}" . format ( enabled ) raise SaltInvocationError ( msg ) return ( 'on' if ( enabled . lower ( ) in [ 'on' , 'yes' ] ) else 'off' ) return ( 'on' if bool ( enabled ) else 'off' )
helper function to validate the enabled parameter .