Modify some attributes of an identity or its name.

        :param: identity a zobjects.Identity with `id` set (mandatory). Also
               set items you want to modify/set and/or the `name` attribute to
               rename the identity.
               Can also take the name in string and then attributes to modify
        :returns: zobjects.Identity object

def modify_identity(self, identity, **kwargs):
        """ Modify some attributes of an identity or its name.

        :param: identity a zobjects.Identity with `id` set (mandatory). Also
               set items you want to modify/set and/or the `name` attribute to
               rename the identity.
               Can also take the name in string and then attributes to modify
        :returns: zobjects.Identity object
        """

        if isinstance(identity, zobjects.Identity):
            self.request('ModifyIdentity', {'identity': identity._full_data})
            return self.get_identities(identity=identity.name)[0]
        else:
            attrs = []
            for attr, value in kwargs.items():
                attrs.append({
                    'name': attr,
                    '_content': value
                })
            self.request('ModifyIdentity', {
                'identity': {
                    'name': identity,
                    'a': attrs
                }
            })
            return self.get_identities(identity=identity)[0]