Map a list of devices to their hostnames.

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

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