<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def apply(request, task_name):
 """View applying a task. **Note:** Please use this with caution. Preferably you shouldn't make this publicly accessible without ensuring your code is safe! """

    try:
        task = tasks[task_name]
    except KeyError:
        raise Http404('apply: no such task')
    return task_view(task)(request)