def clientConnectionFailed(self, connector, reason):
        """
        Report a connection failure in a response to the incoming request as
        an error.
        """
        self.father.setResponseCode(501, b"Gateway error")
        self.father.responseHeaders.addRawHeader(b"Content-Type", b"text/html")
        self.father.write(b"<H1>Could not connect</H1>")
        self.father.finish()

        Report a connection failure in a response to the incoming request as
        an error.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/proxy.py