<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get(cls, key):
 """ str, int or Enum => Enum """

        if isinstance(key, Enum) and not isinstance(key, cls):
            raise TypeError("Cannot type cast between enums")
        if isinstance(key, int):
            if not int(key) in cls._values:
                raise KeyError("There is no enum with key %d" % key)
            return cls._values[key]
        if isinstance(key, (str, unicode)):
            if not key in cls._names:
                raise KeyError("There is no enum with name %s" % key)
            return cls._names[key]
        raise TypeError("Invalid enum key type: %s"
                         % (key.__class__.__name__))