Get the status for a VM, either via the ID or the hostname

def get_vm_status(vmid=None, name=None):
    '''
    Get the status for a VM, either via the ID or the hostname
    '''
    if vmid is not None:
        log.debug('get_vm_status: VMID %s', vmid)
        vmobj = _get_vm_by_id(vmid)
    elif name is not None:
        log.debug('get_vm_status: name %s', name)
        vmobj = _get_vm_by_name(name)
    else:
        log.debug("get_vm_status: No ID or NAME given")
        raise SaltCloudExecutionFailure

    log.debug('VM found: %s', vmobj)

    if vmobj is not None and 'node' in vmobj:
        log.debug("VM_STATUS: Has desired info. Retrieving.. (%s)",
                  vmobj['name'])
        data = query('get', 'nodes/{0}/{1}/{2}/status/current'.format(
            vmobj['node'], vmobj['type'], vmobj['vmid']))
        return data

    log.error('VM or requested status not found..')
    return False