def check_enum(enum, name=None, valid=None):
 name = (name or 'enum')
 res = None
 if isinstance(enum, int):
  if (hasattr(enum, 'name') and enum.name.startswith('GL_')):
   res = enum.name[3:].lower()
 elif isinstance(enum, string_types):
  res = enum.lower()
 if (res is None):
  raise ValueError(('Could not determine string represenatation forenum %r' % enum))
 elif (valid and (res not in valid)):
  raise ValueError(('Value of %s must be one of %r, not %r' % (name, valid, enum)))
 return res

def check_enum ( enum , name = None , valid = None ) : name = ( name or 'enum' ) res = None if isinstance ( enum , int ) : if ( hasattr ( enum , 'name' ) and enum . name . startswith ( 'GL_' ) ) : res = enum . name [ 3 : ] . lower ( ) elif isinstance ( enum , string_types ) : res = enum . lower ( ) if ( res is None ) : raise ValueError ( ( 'Could not determine string represenatation forenum %r' % enum ) ) elif ( valid and ( res not in valid ) ) : raise ValueError ( ( 'Value of %s must be one of %r, not %r' % ( name , valid , enum ) ) ) return res
get lowercase string representation of enum .