'Return a list of dictionaries with query parameters for
a valid block device mapping.
:param      mapping: List of dictionaries with the drive layout
:type       mapping: ``list`` or ``dict``
:return:    Dictionary representation of the drive mapping
:rtype:     ``dict``'

def _get_block_device_mapping_params(self, block_device_mapping):

    if (not isinstance(block_device_mapping, (list, tuple))):
        raise AttributeError('block_device_mapping    not    list    or    tuple')
    params = {}
    for (idx, mapping) in enumerate(block_device_mapping):
        idx += 1
        if (not isinstance(mapping, dict)):
            raise AttributeError(('mapping    %s    in    block_device_mapping    not    a    dict' % mapping))
        for (k, v) in mapping.items():
            if (not isinstance(v, dict)):
                params[('BlockDeviceMapping.%d.%s' % (idx, k))] = str(v)
            else:
                for (key, value) in v.items():
                    params[('BlockDeviceMapping.%d.%s.%s' % (idx, k, key))] = str(value)
    return params
