'Extra bonus feature: vmid = -1 returns a list of everything'

def find_vm(self, vmid):

    conn = self.conn
    vms = []
    ids = conn.listDomainsID()
    for id in ids:
        vm = conn.lookupByID(id)
        vms.append(vm)
    names = conn.listDefinedDomains()
    for name in names:
        vm = conn.lookupByName(name)
        vms.append(vm)
    if (vmid == (-1)):
        return vms
    for vm in vms:
        if (vm.name() == vmid):
            return vm
    raise VMNotFound(('virtual    machine    %s    not    found' % vmid))
