def format_response(resp, body):
    """Format an http.client.HTTPResponse for logging."""
    s = f'{resp.status} {resp.reason}\n'
    s = s + '\n'.join(f'{name}: {value}' for name, value in resp.getheaders())
    s = s + '\n\n' + body
    return s