code: def n1ql_query(self, query, *args, **kwargs):
          
          from couchbase.n1ql import N1QLQuery
          if not isinstance(query, N1QLQuery):
              query = N1QLQuery(query)
  
          query.cross_bucket = True
  
          to_purge = []
          for k, v in self._buckets.items():
              bucket = v()
              if bucket:
                  return bucket.n1ql_query(query, *args, **kwargs)
              else:
                  to_purge.append(k)
  
          for k in to_purge:
              del self._buckets[k]
  
          raise NoBucketError('Must have at least one active bucket for query')
docs: Issue a "cluster-level" query. This requires that at least one
          connection to a bucket is active.
          :param query: The query string or object
          :param args: Additional arguments to :cb_bmeth:`n1ql_query`
  
          .. seealso:: :cb_bmeth:`n1ql_query`