code: def list_fileinfo_from_txt(filename):
      
      
      # check for input file
      if not os.path.isfile(filename):
          # check for wildcards
          list_fits_files = glob.glob(filename)
          if len(list_fits_files) == 0:
              raise ValueError("File " + filename + " not found!")
          else:
              output = [FileInfo(tmpfile) for tmpfile in list_fits_files]
              return output
  
      # if input file is a txt file, assume it is a list of FITS files
      if filename[-4:] == ".txt":
          with open(filename) as f:
              file_content = f.read().splitlines()
          output = []
          for line in file_content:
              if len(line) > 0:
                  if line[0] not in ['#', '@']:
                      tmplist = line.split()
                      tmpfile = tmplist[0]
                      if len(tmplist) > 1:
                          tmpinfo = tmplist[1:]
                      else:
                          tmpinfo = None
                      if not os.path.isfile(tmpfile):
                          raise ValueError("File " + tmpfile + " not found!")
                      output.append(FileInfo(tmpfile, tmpinfo))
      else:
          output = [FileInfo(filename)]
  
      return output
docs: Returns a list of FileInfo instances if filename is a TXT file.
      
      Parameters
      ----------
      filename : string
          Name of a file (wildcards are acceptable) or a TXT file
          containing a list of files. Empty Lines, and lines starting by
          a hash or a at symbol in the TXT file are ignored.
      
      Returns
      -------
      output : list of FileInfo instances
          List of FileInfo instances containing the name of the files
          and additional file information.