human
Complete this python program:
def check_permissions(user, permissions):
assistant
#Here is the Python code you requested.

    """Permissions can be a list or a tuple of lists. If it is a tuple,
    every permission list will be evaluated and the outcome will be checked
    for truthiness.
    Each item of the list(s) must be either a valid Django permission name
    (model.codename) or a property or method on the User model
    (e.g. \is_active\, \is_superuser\).
    Example usage:
    - permissions_required([\is_staff\, ])
    would replace staff_member_required
    - permissions_required([\is_anonymous\, ])
    would replace login_forbidden
    - permissions_required(([\is_staff\,], [\partner.dashboard_access\]))
    allows both staff users and users with the above permission
    """
    def _check_one_permission_list(perms):
        regular_permissions = [perm for perm in perms if ('.' in perm)]
        conditions = [perm for perm in perms if ('.' not in perm)]
        if (conditions and ('is_anonymous' not in conditions) and ('is_active' not in conditions)):
            conditions.append('is_active')
        attributes = [getattr(user, perm) for perm in conditions]
        passes_conditions = all([(attr() if callable(attr) else bool(attr)) for attr in attributes])
        return (passes_conditions and user.has_perms(regular_permissions))
    if (not permissions):
        return True
    elif isinstance(permissions, list):
        return _check_one_permission_list(permissions)
    else:
        return any((_check_one_permission_list(perm) for perm in permissions))