@classmethod
def cls(cls, entity_name, key):
    """Returns the object class based on the entity_name.

        Parameters
        ----------
        entity_name: str
            The help scout object name. E.g.: conversation, mailbox.
        key: str
            The key under which the object's dictionary is contained in the
            API response.
            E.g.: conversations, mailboxes.

        Returns
        -------
        type: The object's class
        """
    if '/' in entity_name:
        parts = entity_name.rsplit('/')
        entity_name = parts[-2] if len(parts) % 2 == 0 else parts[-1]
    if '/' in key:
        parts = key.rsplit('/')
        key = parts[-2] if len(parts) % 2 == 0 else parts[-1]
    plural_letters = -2 if entity_name.endswith('es'
        ) else -1 if entity_name.endswith('s') else None
    class_name = entity_name.capitalize()[:plural_letters]
    existing_class = globals().get(class_name)
    if existing_class is not None:
        return existing_class
    globals()[class_name] = cls = type(class_name, (cls,), {'key': key})
    return cls
