'Prepare the connection for action.
Arguments:
write (bool): are we a writer?'

def _get_connection(self, write=False):

    if (self._connection is not None):
        return
    try:
        self._connection = cassandra.cluster.Cluster(self.servers, port=self.port, auth_provider=self.auth_provider)
        self._session = self._connection.connect(self.keyspace)
        self._write_stmt = cassandra.query.SimpleStatement(Q_INSERT_RESULT.format(table=self.table, expires=self.cqlexpires))
        self._write_stmt.consistency_level = self.write_consistency
        self._read_stmt = cassandra.query.SimpleStatement(Q_SELECT_RESULT.format(table=self.table))
        self._read_stmt.consistency_level = self.read_consistency
        if write:
            self._make_stmt = cassandra.query.SimpleStatement(Q_CREATE_RESULT_TABLE.format(table=self.table))
            self._make_stmt.consistency_level = self.write_consistency
            try:
                self._session.execute(self._make_stmt)
            except cassandra.AlreadyExists:
                pass
    except cassandra.OperationTimedOut:
        if (self._connection is not None):
            self._connection.shutdown()
        self._connection = None
        self._session = None
        raise
