<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def vb_stop_vm(name=None, timeout=10000, **kwargs):
    '''
    Tells Virtualbox to stop a VM.
    This is a blocking function!

    @param name:
    @type name: str
    @param timeout: Maximum time in milliseconds to wait or -1 to wait indefinitely
    @type timeout: int
    @return untreated dict of stopped VM
    '''
    vbox = vb_get_box()
    machine = vbox.findMachine(name)
    log.info('Stopping machine %s', name)
    session = _virtualboxManager.openMachineSession(machine)
    try:
        console = session.console
        progress = console.powerDown()
        progress.waitForCompletion(timeout)
    finally:
        _virtualboxManager.closeMachineSession(session)
        vb_wait_for_session_state(session)
    log.info('Stopped machine %s is now %s', name, vb_machinestate_to_str(machine.state))
    return vb_xpcom_to_attribute_dict(machine, 'IMachine')