def int_enum(cls, val):
    """Get int enum value.

    Parameters
    ----------
    cls : `type`
        Int enum class.
    val : `int` or `str`
        Name or value.

    Returns
    -------
    `IntEnum`

    Raises
    ------
    ValueError
    """
    if isinstance(val, str):
        val = val.upper()
        try:
            return getattr(cls, val)
        except AttributeError:
            raise ValueError('{0}.{1}'.format(cls, val))
    return cls(val)