def has_role(user, roles):
    if user and user.is_superuser:
        return True

    if not isinstance(roles, list):
        roles = [roles]

    normalized_roles = []
    for role in roles:
        if not inspect.isclass(role):
            role = RolesManager.retrieve_role(role)

        normalized_roles.append(role)

    try:
        user_role = get_user_role(user)
    except __HOLE__:
        return False

    if not user_role:
        return False

    return user_role in normalized_roles
dataset/ETHPy150Open vintasoftware/django-role-permissions/rolepermissions/verifications.py/has_role