code: def foreach(self, argv, func):
          
          if len(argv) == 0:
              error("Command requires a search specifier.", 2)
          for item in argv:
              job = self.lookup(item)
              if job is None:
                  error("Search job '%s' does not exist" % item, 2)
              func(job)
docs: Apply the function to each job specified in the argument vector.