Apply the function to each job specified in the argument vector.

def foreach(self, argv, func):
        """Apply the function to each job specified in the argument vector."""
        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)