code: def apply_mtlist_budget_obs(list_filename,gw_filename="mtlist_gw.dat",
                              sw_filename="mtlist_sw.dat",
                              start_datetime="1-1-1970"):
      
      try:
          import flopy
      except Exception as e:
          raise Exception("error import flopy: {0}".format(str(e)))
      mt = flopy.utils.MtListBudget(list_filename)
      gw, sw = mt.parse(start_datetime=start_datetime, diff=True)
      gw = gw.drop([col for col in gw.columns
                    for drop_col in ["kper", "kstp", "tkstp"]
                    if (col.lower().startswith(drop_col))], axis=1)
      gw.to_csv(gw_filename, sep=' ', index_label="datetime", date_format="%Y%m%d")
      if sw is not None:
          sw = sw.drop([col for col in sw.columns
                        for drop_col in ["kper", "kstp", "tkstp"]
                        if (col.lower().startswith(drop_col))], axis=1)
          sw.to_csv(sw_filename, sep=' ', index_label="datetime", date_format="%Y%m%d")
      return gw, sw
docs: process an MT3D list file to extract mass budget entries.
  
      Parameters
      ----------
      list_filename : str
          the mt3d list file
      gw_filename : str
          the name of the output file with gw mass budget information.
          Default is "mtlist_gw.dat"
      sw_filename : str
          the name of the output file with sw mass budget information.
          Default is "mtlist_sw.dat"
      start_datatime : str
          an str that can be cast to a pandas.TimeStamp.  Used to give
          observations a meaningful name
  
      Returns
      -------
      gw : pandas.DataFrame
          the gw mass dataframe
      sw : pandas.DataFrame (optional)
          the sw mass dataframe
  
      Note
      ----
      requires flopy
  
      if SFT is not active, no SW mass budget will be returned