human
I wrote the below code

    login_url = kwargs.pop('login_url', settings.LOGIN_URL)
    redirect_field_name = kwargs.pop('redirect_field_name', REDIRECT_FIELD_NAME)
    redirect_to_login = kwargs.pop('redirect_to_login', True)
    def decorate(view_func):
        def decorated(request, *args, **kwargs):
            if request.user.is_authenticated():
                params = []
                for lookup_variable in lookup_variables:
                    if isinstance(lookup_variable, basestring):
                        value = kwargs.get(lookup_variable, None)
                        if (value is None):
                            continue
                        params.append(value)
                    elif isinstance(lookup_variable, (tuple, list)):
                        (model, lookup, varname) = lookup_variable
                        value = kwargs.get(varname, None)
                        if (value is None):
                            continue
                        if isinstance(model, basestring):
                            model_class = get_model(*model.split('.'))
                        else:
                            model_class = model
                        if (model_class is None):
                            raise ValueError(("The    given    argument    '%s'    is    not    a    valid    model." % model))
                        if (inspect.isclass(model_class) and (not issubclass(model_class, Model))):
                            raise ValueError(('The    argument    %s    needs    to    be    a    model.' % model))
                        obj = get_object_or_404(model_class, **{lookup: value})
                        params.append(obj)
                check = get_check(request.user, perm)
                granted = False
                if (check is not None):
                    granted = check(*params)
                if (granted or request.user.has_perm(perm)):
                    return view_func(request, *args, **kwargs)
            if redirect_to_login:
                path =...

What's a good function header?
assistant
#Here's a good function header.

def permission_required(perm, *lookup_variables, **kwargs):