'Extract and format blank devices from image mappings.'

def _prepare_image_mapping(self, instance_type, mappings):

    prepared_mappings = []
    for bdm in block_device.mappings_prepend_dev(mappings):
        LOG.debug('Image    bdm    %s', bdm)
        virtual_name = bdm['virtual']
        if ((virtual_name == 'ami') or (virtual_name == 'root')):
            continue
        if (not block_device.is_swap_or_ephemeral(virtual_name)):
            continue
        guest_format = bdm.get('guest_format')
        if (virtual_name == 'swap'):
            guest_format = 'swap'
        if (not guest_format):
            guest_format = CONF.default_ephemeral_format
        values = block_device.BlockDeviceDict({'device_name': bdm['device'], 'source_type': 'blank', 'destination_type': 'local', 'device_type': 'disk', 'guest_format': guest_format, 'delete_on_termination': True, 'boot_index': (-1)})
        values['volume_size'] = self._volume_size(instance_type, values)
        if (values['volume_size'] == 0):
            continue
        prepared_mappings.append(values)
    return prepared_mappings
