@classmethod
def from_value(cls, value):
    """Convert a value to corresponding Enum member

        :param value: The value to compare to Enum members
           If it is already a member of Enum, it is returned directly.
        :return: The corresponding enum member
        :rtype: Enum
        :raise ValueError: In case the conversion is not possible
        """
    if isinstance(value, cls):
        return value
    for member in cls:
        if value == member.value:
            return member
    raise ValueError('Cannot convert: %s' % value)
