code: def _write_mtlist_ins(ins_filename,df,prefix):
      
      try:
          dt_str = df.index.map(lambda x: x.strftime("%Y%m%d"))
      except:
          dt_str = df.index.map(lambda x: "{0:08.1f}".format(x).strip())
      if prefix == '':
          name_len = 11
      else:
          name_len = 11 - (len(prefix)+1)
      with open(ins_filename,'w') as f:
          f.write('pif ~\nl1\n')
  
          for dt in dt_str:
              f.write("l1 ")
              for col in df.columns:
                  col = col.replace("(",'').replace(")",'')
                  raw = col.split('_')
                  name = ''.join([r[:2] for r in raw[:-2]])[:6] + raw[-2] + raw[-1][0]
                  #raw[0] = raw[0][:6]
                  #name = ''.join(raw)
                  if prefix == '':
                      obsnme = "{1}_{2}".format(prefix,name[:name_len],dt)
                  else:
                      obsnme = "{0}_{1}_{2}".format(prefix, name[:name_len], dt)
                  f.write(" w !{0}!".format(obsnme))
              f.write("\n")
docs: write an instruction file for a MODFLOW list file
  
      Parameters
      ----------
      ins_filename : str
          name of the instruction file to write
      df : pandas.DataFrame
          the dataframe of list file entries
      prefix : str
          the prefix to add to the column names to form
          obseravtions names