def as_choices(self, perm):
        if not isinstance(perm, int):
            raise UnknownPermission("'perm' must be an integer")
        result_list = []
        for key, val in self.items():
            if key & perm == key:
                result_list.append((key, val))
        return result_list
A utility method to convert an integer into a list of integer, string tuples for choices
dataset/ETHPy150Open callowayproject/django-objectpermissions/objectpermissions/models.py/ModelPermissions.as_choices