<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_machines(self, origin, hostnames):
 """Return a set of machines based on `hostnames`. Any hostname that is not found will result in an error. """

        hostnames = {
            hostname: True
            for hostname in hostnames
        }
        machines = origin.Machines.read(hostnames=hostnames)
        machines = [
            machine
            for machine in machines
            if hostnames.pop(machine.hostname, False)
        ]
        if len(hostnames) > 0:
            raise CommandError(
                "Unable to find %s %s." % (
                    "machines" if len(hostnames) > 1 else "machine",
                    ','.join(hostnames)))
        return machines