def _format_mappings(properties, result):
 mappings = [{'virtualName': m['virtual'], 'deviceName': m['device']} for m in _properties_get_mappings(properties) if block_device.is_swap_or_ephemeral(m['virtual'])]
 block_device_mapping = [_format_block_device_mapping(bdm) for bdm in properties.get('block_device_mapping', [])]
 for bdm in block_device_mapping:
  for i in range(len(mappings)):
   if (bdm['deviceName'] == mappings[i]['deviceName']):
    del mappings[i]
    break
  mappings.append(bdm)
 mappings = [bdm for bdm in mappings if (not bdm.get('noDevice', False))]
 if mappings:
  result['blockDeviceMapping'] = mappings

def _format_mappings ( properties , result ) : mappings = [ { 'virtualName' : m [ 'virtual' ] , 'deviceName' : m [ 'device' ] } for m in _properties_get_mappings ( properties ) if block_device . is_swap_or_ephemeral ( m [ 'virtual' ] ) ] block_device_mapping = [ _format_block_device_mapping ( bdm ) for bdm in properties . get ( 'block_device_mapping' , [ ] ) ] for bdm in block_device_mapping : for i in range ( len ( mappings ) ) : if ( bdm [ 'deviceName' ] == mappings [ i ] [ 'deviceName' ] ) : del mappings [ i ] break mappings . append ( bdm ) mappings = [ bdm for bdm in mappings if ( not bdm . get ( 'noDevice' , False ) ) ] if mappings : result [ 'blockDeviceMapping' ] = mappings
format multiple blockdevicemappingitemtype .