human
I wrote the below code

    def url(port, path):
        return (u'http://%s:%s%s' % (socket.gethostname().lower(), port, path))
    responses = list(reversed(resp))
    class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler, ):
        def do_HEAD(self):
            response = responses.pop()
            assert (response.path == self.path)
            self.send_response(response.code)
            for (header, value) in list(response.headers.items()):
                self.send_header(header, value)
            self.end_headers()
    httpd = SocketServer.TCPServer((u'', 0), MyHandler)
    t = threading.Thread(target=httpd.serve_forever)
    t.setDaemon(True)
    t.start()
    port = httpd.server_address[1]
    (yield functools.partial(url, port))
    httpd.shutdown()

What's a good function header?
assistant
#Here's a good function header.

@contextlib.contextmanager
def start_server(*resp):