def create_identity(self, user, sp_mapping, **extra_config):
        """ Generate an identity dictionary of the user based on the given mapping of desired user attributes by the SP
        """

        return {
            out_attr: getattr(user, user_attr)
            for user_attr, out_attr in sp_mapping.items()
            if hasattr(user, user_attr)
        }
Generate an identity dictionary of the user based on the given mapping of desired user attributes by the SP