def METHOD_NAME(request, headers_to_sign):
    headers = dict((name.lower(), value) for name, value in request.http_request.headers.items() if value)
    if 'content-length' in headers and headers['content-length'] == '0':
        del headers['content-length']
    return '\n'.join(headers.get(x, '') for x in headers_to_sign) + '\n'