code: def list_commands(self, *path):
          
          path_str = ':'.join(path)
  
          commands = []
          for command in self.commands:
  
              # Filter based on prefix and the segment length
              if all([command.startswith(path_str),
                      len(path) == command.count(":")]):
  
                  # offset is used to exclude the path that the caller requested.
                  offset = len(path_str) + 1 if path_str else 0
                  commands.append(command[offset:])
  
          return sorted(commands)
docs: Command listing.