'Handles requests which are generated by code similar to:
instance.modify_attribute(\'blockDeviceMapping\', {\'/dev/sda1\': True})
The querystring contains information similar to:
BlockDeviceMapping.1.Ebs.DeleteOnTermination : [\'true\']
BlockDeviceMapping.1.DeviceName : [\'/dev/sda1\']
For now we only support the "BlockDeviceMapping.1.Ebs.DeleteOnTermination"
configuration, but it should be trivial to add anything else.'

def _block_device_mapping_handler(self):

    mapping_counter = 1
    mapping_device_name_fmt = u'BlockDeviceMapping.%s.DeviceName'
    mapping_del_on_term_fmt = u'BlockDeviceMapping.%s.Ebs.DeleteOnTermination'
    while True:
        mapping_device_name = (mapping_device_name_fmt % mapping_counter)
        if (mapping_device_name not in self.querystring.keys()):
            break
        mapping_del_on_term = (mapping_del_on_term_fmt % mapping_counter)
        del_on_term_value_str = self.querystring[mapping_del_on_term][0]
        del_on_term_value = (True if (u'true' == del_on_term_value_str) else False)
        device_name_value = self.querystring[mapping_device_name][0]
        instance_ids = instance_ids_from_querystring(self.querystring)
        instance_id = instance_ids[0]
        instance = self.ec2_backend.get_instance(instance_id)
        if self.is_not_dryrun(u'ModifyInstanceAttribute'):
            block_device_type = instance.block_device_mapping[device_name_value]
            block_device_type.delete_on_termination = del_on_term_value
        mapping_counter += 1
    if (mapping_counter > 1):
        return EC2_MODIFY_INSTANCE_ATTRIBUTE
