def METHOD_NAME(request, metric=None):
    """Controller for threshold search"""
    if request.method == 'POST':
        form = ThresholdForm(request.POST)
        metric = request.POST.get('target')
        if form.is_valid():
            handle_threshold_form(form, request)
            return redirect('threshold-index')
    else:
        if metric:
            form = ThresholdForm(initial={'target': metric})
        else:
            form = ThresholdForm()
    heading = 'Add threshold rule'
    navpath = get_path() + [(heading,)]
    title = create_title(navpath)
    context = {
        'heading': heading,
        'form': form,
        'metric': metric,
        'title': title,
        'navpath': navpath,
        'id': None,
    }
    return render(request, 'threshold/set_threshold.html', context)