<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def map_clonemode(vm_info):
 """ Convert the virtualbox config file values for clone_mode into the integers the API requires """

    mode_map = {
      'state': 0,
      'child': 1,
      'all':   2
    }

    if not vm_info:
        return DEFAULT_CLONE_MODE

    if 'clonemode' not in vm_info:
        return DEFAULT_CLONE_MODE

    if vm_info['clonemode'] in mode_map:
        return mode_map[vm_info['clonemode']]
    else:
        raise SaltCloudSystemExit(
            "Illegal clonemode for virtualbox profile.  Legal values are: {}".format(','.join(mode_map.keys()))
        )