def _execute_after_prepare(self, host, connection, pool, response):
        """
        Handle the response to our attempt to prepare a statement.
        If it succeeded, run the original query again against the same host.
        """
        if pool:
            pool.return_connection(connection)

        if self._final_exception:
            return

        if isinstance(response, ResultMessage):
            if response.kind == RESULT_KIND_PREPARED:
                if self.prepared_statement:
                    # result metadata is the only thing that could have
                    # changed from an alter
                    (_, _, _,
                     self.prepared_statement.result_metadata,
                     new_metadata_id) = response.results
                    if new_metadata_id is not None:
                        self.prepared_statement.result_metadata_id = new_metadata_id

                # use self._query to re-use the same host and
                # at the same time properly borrow the connection
                request_id = self._query(host)
                if request_id is None:
                    # this host errored out, move on to the next
                    self.send_request()
            else:
                self._set_final_exception(ConnectionException(
                    "Got unexpected response when preparing statement "
                    "on host %s: %s" % (host, response)))
        elif isinstance(response, ErrorMessage):
            if hasattr(response, 'to_exception'):
                self._set_final_exception(response.to_exception())
            else:
                self._set_final_exception(response)
        elif isinstance(response, ConnectionException):
            log.debug("Connection error when preparing statement on host %s: %s",
                      host, response)
            # try again on a different host, preparing again if necessary
            self._errors[host] = response
            self.send_request()
        else:
            self._set_final_exception(ConnectionException(
                "Got unexpected response type when preparing "
                "statement on host %s: %s" % (host, response)))
Handle the response to our attempt to prepare a statement.
        If it succeeded, run the original query again against the same host.