code: def cache_connect(database=None):
      
      if database is None:
          database = cache_file()
  
      if os.path.isfile(database):
          # just connect to the database as-is
          conn = sqlite3.connect(database)
      else:
          # we need to populate the database
          conn = sqlite3.connect(database)
          conn.executescript(schema)
  
      with conn as cur:
          # turn on foreign keys, allows deletes to cascade.
          cur.execute("PRAGMA foreign_keys = ON;")
  
      conn.row_factory = sqlite3.Row
  
      return conn
docs: Returns a connection object to a sqlite database.
  
      Args:
          database (str, optional): The path to the database the user wishes
              to connect to. If not specified, a default is chosen using
              :func:`.cache_file`. If the special database name ':memory:'
              is given, then a temporary database is created in memory.
  
      Returns:
          :class:`sqlite3.Connection`