docs: def get_index(fn, cols, names, sep):
      """Restores the index for a given file.
  
      Args:
          fn (str): the name of the file.
          cols (list): a list containing column to keep (as int).
          names (list): the name corresponding to the column to keep (as str).
          sep (str): the field separator.
  
      Returns:
          pandas.DataFrame: the index.
  
      If the index doesn't exist for the file, it is first created.
  
      """
      if not has_index(fn):
          # The index doesn't exists, generate it
          return generate_index(fn, cols, names, sep)
  
      # Retrieving the index
      file_index = read_index(get_index_fn(fn))
  
      # Checking the names are there
      if len(set(names) - (set(file_index.columns) - {'seek'})) != 0:
          raise ValueError("{}: missing index columns: reindex".format(fn))
  
      if "seek" not in file_index.columns:
          raise ValueError("{}: invalid index: reindex".format(fn))
  
      return file_index