code: def find_archive_program (format, command, program=None):
      
      commands = ArchivePrograms[format]
      programs = []
      if program is not None:
          # try a specific program first
          programs.append(program)
      # first try the universal programs with key None
      for key in (None, command):
          if key in commands:
              programs.extend(commands[key])
      if not programs:
          raise util.PatoolError("%s archive format `%s' is not supported" % (command, format))
      # return the first existing program
      for program in programs:
          if program.startswith('py_'):
              # it's a Python module and therefore always supported
              return program
          exe = util.find_program(program)
          if exe:
              if program == '7z' and format == 'rar' and not util.p7zip_supports_rar():
                  continue
              return exe
      # no programs found
      raise util.PatoolError("could not find an executable program to %s format %s; candidates are (%s)," % (command, format, ",".join(programs)))
docs: Find suitable archive program for given format and mode.