code: def __new__(cls, value):
      # all enum instances are actually created during class construction
      # without calling this method; this method is called by the metaclass'
      # __call__ (i.e. Color(3) ), and by pickle
      if type(value) is cls:
          # For lookups like Color(Color.red)
          value = value.value
          # return value
      # by-value search for a matching enum member
      # see if it's in the reverse mapping (for hashable values)
      try:
          if value in cls._value2member_map_:
              return cls._value2member_map_[value]
      except TypeError:
          # not there, now do long search -- O(n) behavior
          for member in cls._member_map_.values():
              if member.value == value:
                  return member
      raise ValueError("%s is not a valid %s" % (value, cls.__name__))
  
imports: import sys
label_desc: Use image node_id 5 for calling a global function with example usage: __new__(cls, value) and returns: cls, member