async def _handle_exception(self, e, sock):
        """
        Given an exception, we want to handle it appropriately. Some exceptions we
        prefer to shadow with an asks exception, and some we want to raise directly.
        In all cases we clean up the underlying socket.
        """
        if isinstance(e, (RemoteProtocolError, AssertionError)):
            await sock.close()
            raise BadHttpResponse('Invalid HTTP response from server.') from e

        if isinstance(e, Exception):
            await sock.close()
            raise e
Given an exception, we want to handle it appropriately. Some exceptions we
        prefer to shadow with an asks exception, and some we want to raise directly.
        In all cases we clean up the underlying socket.