def format_request(url, method, body, headers):
    """Return a representation of a request"""
    if hasattr(headers, 'items'):
        headers = '\n'.join("%s: %s" % pair for pair in headers.items())
    return """Request: {method} {url}
{headers}

{body}
""".format(method=method, url=url, headers=headers, body=body)