def group_has_perm(group, perm, obj=None):
    if obj:
        return perm in get_perms(group, obj)
    else:
        for gperm in group.permissions.all():
            if gperm.codename == perm:
                return True
        return False
dataset/ETHPy150Open stackdio/stackdio/stackdio/core/tests/utils.py/group_has_perm/original