@classmethod
def from_key(cls, key):
    """
        Returns the enum instance for the given string key.
        """
    keymap = cls._get_key_cache()
    try:
        return keymap[key]
    except KeyError:
        raise KeyError('Key "{}" not found in enum "{}"'.format(key, cls.
            __name__)) from None
