'Connect to the Couchbase server.'

def _get_connection(self):

    if (self._connection is None):
        kwargs = {u'bucket': self.bucket, u'host': self.host}
        if self.port:
            kwargs.update({u'port': self.port})
        if self.username:
            kwargs.update({u'username': self.username})
        if self.password:
            kwargs.update({u'password': self.password})
        logging.debug(u'couchbase    settings    %r', kwargs)
        self._connection = Connection(**kwargs)
    return self._connection
