<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def entity_attributes(self, entity_id):
 """ Get all entity attributes for an entry in the metadata. Example return data: {'http://macedir.org/entity-category': ['something', 'something2'], 'http://example.org/saml-foo': ['bar']} :param entity_id: Entity id :return: dict with keys and value-lists from metadata :type entity_id: string :rtype: dict """

        res = {}
        try:
            ext = self.__getitem__(entity_id)["extensions"]
        except KeyError:
            return res
        for elem in ext["extension_elements"]:
            if elem["__class__"] == ENTITYATTRIBUTES:
                for attr in elem["attribute"]:
                    if attr["name"] not in res:
                        res[attr["name"]] = []
                    res[attr["name"]] += [v["text"] for v in attr[
                        "attribute_value"]]
        return res