code: def db_create(cls, impl, working_dir):
          
  
          global VIRTUALCHAIN_DB_SCRIPT
         
          log.debug("Setup chain state in {}".format(working_dir))
  
          path = config.get_snapshots_filename(impl, working_dir)
          if os.path.exists( path ):
              raise Exception("Database {} already exists")
  
          lines = [l + ";" for l in VIRTUALCHAIN_DB_SCRIPT.split(";")]
          con = sqlite3.connect(path, isolation_level=None, timeout=2**30)
  
          for line in lines:
              con.execute(line)
  
          con.row_factory = StateEngine.db_row_factory
          return con
docs: Create a sqlite3 db at the given path.
          Create all the tables and indexes we need.
          Returns a db connection on success
          Raises an exception on error