def request_method(request):
    """Returns the effective HTTP method of a request. To support the entire range of HTTP methods
    from HTML forms (which only support GET and POST), an HTTP method may be emulated by
    setting a POST parameter named "_method" to the name of the HTTP method to be emulated.
    
    Example HTML:
        <!-- Submits a form using the PUT method -->
        
        <form>
            <input type="text" name="name" value="value" />
            <button type="submit" name="_method" value="put">Update</button>
        </form>
    
    Args:
        request: an HttpRequest
    
    Returns:
        An upper-case string naming the HTTP method (like django.http.HttpRequest.method)
    """
    if request.method == 'POST' and '_method' in request.POST:
        method = request.POST['_method'].upper()
    else:
        method = request.method
    return method
