def boolean_validator(value, context):
 if ((value is missing) or (value is None)):
  return False
 if isinstance(value, bool):
  return value
 if (value.lower() in ['true', 'yes', 't', 'y', '1']):
  return True
 return False

def boolean_validator ( value , context ) : if ( ( value is missing ) or ( value is None ) ) : return False if isinstance ( value , bool ) : return value if ( value . lower ( ) in [ 'true' , 'yes' , 't' , 'y' , '1' ] ) : return True return False
return a boolean for value .