code: def _iter_process_command(mapping, pid, max_depth):
      
      for _ in range(max_depth):
          try:
              proc = mapping[pid]
          except KeyError:    # We've reached the root process. Give up.
              break
          try:
              cmd = proc.args[0]
          except IndexError:  # Process has no name? Whatever, ignore it.
              pass
          else:
              yield cmd
          pid = proc.ppid
docs: Iterator to traverse up the tree, yielding `argv[0]` of each process.