<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_identities(self, identity=None, attrs=None):
 """ Get identities matching name and attrs of the user, as a list :param: zobjects.Identity or identity name (string) :param: attrs dict of attributes to return only identities matching :returns: list of zobjects.Identity """

        resp = self.request('GetIdentities')

        if 'identity' in resp:
            identities = resp['identity']
            if type(identities) != list:
                identities = [identities]

            if identity or attrs:
                wanted_identities = []

                for u_identity in [
                        zobjects.Identity.from_dict(i) for i in identities]:
                    if identity:
                        if isinstance(identity, zobjects.Identity):
                            if u_identity.name == identity.name:
                                return [u_identity]
                        else:
                            if u_identity.name == identity:
                                return [u_identity]

                    elif attrs:
                        for attr, value in attrs.items():
                            if (attr in u_identity._a_tags and
                                    u_identity._a_tags[attr] == value):
                                wanted_identities.append(u_identity)
                return wanted_identities
            else:
                return [zobjects.Identity.from_dict(i) for i in identities]
        else:
            return []