human
Give me a the Python program you requested given the following:
Complete the below
def _process_mass_form(f):

    ''''Pre-process request to handle mass action form for Tasks and Milestones'
    '''
assistant
#Here is the Python program you requested.
    def wrap(request, *args, **kwargs):
        'Wrap'
        if ('massform' in request.POST):
            for key in request.POST:
                if ('mass-milestone' in key):
                    try:
                        milestone = Milestone.objects.get(pk=request.POST[key])
                        form = MassActionForm(request.user.profile, request.POST, instance=milestone)
                        if (form.is_valid() and request.user.profile.has_permission(milestone, mode='w')):
                            form.save()
                    except Exception:
                        pass
            for key in request.POST:
                if ('mass-task' in key):
                    try:
                        task = Task.objects.get(pk=request.POST[key])
                        form = MassActionForm(request.user.profile, request.POST, instance=task)
                        if (form.is_valid() and request.user.profile.has_permission(task, mode='w')):
                            form.save()
                    except Exception:
                        pass
        return f(request, *args, **kwargs)
    wrap.__doc__ = f.__doc__
    wrap.__name__ = f.__name__
    return wrap