'Get a SQLite connection object to the underlying database.
One connection object is created per thread.'

def _connection(self):

    thread_id = threading.current_thread().ident
    with self._shared_map_lock:
        if (thread_id in self._connections):
            return self._connections[thread_id]
        else:
            conn = self._create_connection()
            self._connections[thread_id] = conn
            return conn
