def assign(self, permission, user_or_group, obj=None):
        
        (perm, ct) = self.get_permission_and_content_type(permission, obj)
        
        assigned_dict = {
            'permission': perm,
            'content_type': ct,
            'object_id': None
        }
        
        if obj:
            assigned_dict['object_id'] = obj.id

        if isinstance(user_or_group, User):
            assigned_dict['user'] = user_or_group
        elif isinstance(user_or_group, Group):
            assigned_dict['group'] = user_or_group
        else:
            raise TypeError('Permissions must be assigned to a User or Group instance.')
        
        return AssignedPermission.objects.get_or_create(**assigned_dict)
Check metadata sent in the request headers.  This should only check
dataset/ETHPy150Open jlecker/django-rubberstamp/rubberstamp/models.py/AppPermissionManager.assign--crossover with--dataset/ETHPy150Open openstack/swift/swift/common/constraints.py/check_metadata