code: def getProcessName(self, pid):
          
          ps = subprocess.check_output(["ps", "aux"]).decode("ascii")
          processes = ps.split("\n")
          cols = len(processes[0].split()) - 1
          for row in processes[1:]:
              if row != "":
                  proc = row.split(None, cols)
                  if proc[1].strip() == str(pid):
                      return proc[-1]
docs: Searches all processes for the given PID, then returns the originating command