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

def get_device_names_to_objects(devices):
    '''Map a list of devices to their hostnames.

    :param devices: list -- list of ManagementRoot objects
    :returns: dict -- mapping of hostnames to ManagementRoot objects
    '''

    name_to_object = {}
    for device in devices:
        device_name = get_device_info(device).name
        name_to_object[device_name] = device
    return name_to_object