code: def open_data_base_connection(skip_dir_check=False):
      
      if not skip_dir_check:
          assert os.path.isfile(dd.get_database_dir()), \
              "Database file not found in {}. " \
              "Please ensure that you have written data atleast once.".format(dd.get_database_dir())
  
      # Converts np.array to TEXT when inserting
      sqlite3.register_adapter(np.ndarray, adapt_array)
  
      # Converts TEXT to np.array when selecting
      sqlite3.register_converter("array", convert_array)
  
      conn = sqlite3.connect(dd.get_database_dir(), detect_types=sqlite3.PARSE_DECLTYPES)
      c = conn.cursor()
      return conn, c
docs: Creates a connections to the crystal database.
      :param skip_dir_check: bool, True  -> Skips checking database file and creates a new one if not present.
                                            This is used by Crystal.py to create a new database the first time.
                                   False -> Raises a error if the database file is not found.
      :return: conn, c -> connection and cursor object