docs: def get_project_name_from_path(path, append_mx=False):
      """Get the project name from a path.
  
      For a path "/home/peter/hans/HLC12398/online/M1_13.tdms" or
      For a path "/home/peter/hans/HLC12398/online/data/M1_13.tdms" or
      without the ".tdms" file, this will return always "HLC12398".
  
      Parameters
      ----------
      path: str
          path to tdms file
      append_mx: bool
          append measurement number, e.g. "M1"
      """
      path = pathlib.Path(path)
      if path.suffix == ".tdms":
          dirn = path.parent
          mx = path.name.split("_")[0]
      elif path.is_dir():
          dirn = path
          mx = ""
      else:
          dirn = path.parent
          mx = ""
  
      project = ""
      if mx:
          # check para.ini
          para = dirn / (mx + "_para.ini")
          if para.exists():
              with para.open() as fd:
                  lines = fd.readlines()
              for line in lines:
                  if line.startswith("Sample Name ="):
                      project = line.split("=")[1].strip()
                      break
  
      if not project:
          # check if the directory contains data or is online
          root1, trail1 = dirn.parent, dirn.name
          root2, trail2 = root1.parent, root1.name
          trail3 = root2.name
  
          if trail1.lower() in ["online", "offline"]:
              # /home/peter/hans/HLC12398/online/
              project = trail2
          elif (trail1.lower() == "data" and
                trail2.lower() in ["online", "offline"]):
              # this is olis new folder sctructure
              # /home/peter/hans/HLC12398/online/data/
              project = trail3
          else:
              project = trail1
  
      if append_mx:
          project += " - " + mx
  
      return project