code: def _database(self, writable=False):
          
          if self.path == MEMORY_DB_NAME:
              if not self.inmemory_db:
                  self.inmemory_db = xapian.inmemory_open()
              return self.inmemory_db
          if writable:
              database = xapian.WritableDatabase(self.path, xapian.DB_CREATE_OR_OPEN)
          else:
              try:
                  database = xapian.Database(self.path)
              except xapian.DatabaseOpeningError:
                  raise InvalidIndexError('Unable to open index at %s' % self.path)
  
          return database
docs: Private method that returns a xapian.Database for use.
  
          Optional arguments:
              ``writable`` -- Open the database in read/write mode (default=False)
  
          Returns an instance of a xapian.Database or xapian.WritableDatabase