code: def export_msdt(self, filename):
          
          fmt = "csv" if filename.lower().endswith(".csv") else "dat"
          delimiter = ", " if fmt == "csv" else " "
          with open(filename, "wt") as f:
              if fmt == "dat":
                  f.write("# ")
              f.write(delimiter.join(["t", "MSD", "MSD_a", "MSD_b", "MSD_c",
                                      "MSCD"]))
              f.write("\n")
              for dt, msd, msdc, mscd in zip(self.dt, self.msd,
                                             self.msd_components, self.mscd):
                  f.write(delimiter.join(["%s" % v for v in [dt, msd] + list(
                      msdc) + [mscd]]))
                  f.write("\n")
docs: Writes MSD data to a csv file that can be easily plotted in other
          software.
  
          Args:
              filename (str): Filename. Supported formats are csv and dat. If
                  the extension is csv, a csv file is written. Otherwise,
                  a dat format is assumed.