def set_vm_status(status, name=None, vmid=None):
    '''
    Convenience function for setting VM status
    '''
    log.debug('Set status to %s for %s (%s)', status, name, vmid)

    if vmid is not None:
        log.debug('set_vm_status: via ID - VMID %s (%s): %s',
                  vmid, name, status)
        vmobj = _get_vm_by_id(vmid)
    else:
        log.debug('set_vm_status: via name - VMID %s (%s): %s',
                  vmid, name, status)
        vmobj = _get_vm_by_name(name)

    if not vmobj or 'node' not in vmobj or 'type' not in vmobj or 'vmid' not in vmobj:
        log.error('Unable to set status %s for %s (%s)',
                  status, name, vmid)
        raise SaltCloudExecutionTimeout

    log.debug("VM_STATUS: Has desired info (%s). Setting status..", vmobj)
    data = query('post', 'nodes/{0}/{1}/{2}/status/{3}'.format(
        vmobj['node'], vmobj['type'], vmobj['vmid'], status))

    result = _parse_proxmox_upid(data, vmobj)

    if result is not False and result is not None:
        log.debug('Set_vm_status action result: %s', result)
        return True

    return False
Convenience function for setting VM status