code: def read_csv(csvfile, options):
      
  
      # open file or exit
      name, ext = os.path.splitext(csvfile)
      try:
          if ext == '.gz':
              f = gzip.open(csvfile, 'rb')
          else:
              f = open(csvfile, 'rU')
      except IOError:
          print(" \n '{f}' could not be opened\n".format(f=os.path.basename(csvfile)))
          sys.exit(1)
  
      # read file
      csv_reader = csv.reader(f)
      molList = []
      linenumber = 1
  
      for line in csv_reader:
          # get column labels from the first line
          if linenumber == 1:
              prop_indices = read_header(line, options)
  
          # otherwise read line & append to MolList
          else:
              mol = Molecule()
              mol = read_line(line, options, prop_indices, mol)
              # if the line's junk, skip it
              if mol == 1:
                  print(" skipping molecule 'm'\n".format(m=(linenumber - 1)))
              else:
                  molList.append(mol)
  
          linenumber += 1
  
      # return molList
  
      return molList
docs: Read csv and return molList, a list of mol objects