code: def int_enum(cls, val):
      
      if isinstance(val, str):
          val = val.upper()
          try:
              return getattr(cls, val)
          except AttributeError:
              raise ValueError('{0}.{1}'.format(cls, val))
      return cls(val)
docs: Get int enum value.
  
      Parameters
      ----------
      cls : `type`
          Int enum class.
      val : `int` or `str`
          Name or value.
  
      Returns
      -------
      `IntEnum`
  
      Raises
      ------
      ValueError