human
Complete this python program:
def _process_mass_lead_form(f):
assistant
#Here is the Python program you requested.

    """Pre-process request to handle mass action form for Orders
    """
    def wrap(request, *args, **kwargs):
        'Wrap'
        if ('massform' in request.POST):
            for key in request.POST:
                if ('mass-lead' in key):
                    try:
                        lead = Lead.objects.get(pk=request.POST[key])
                        form = LeadMassActionForm(request.user.profile, request.POST, instance=lead)
                        if (form.is_valid() and request.user.profile.has_permission(lead, mode='w')):
                            form.save()
                    except:
                        pass
        return f(request, *args, **kwargs)
    wrap.__doc__ = f.__doc__
    wrap.__name__ = f.__name__
    return wrap