code: def _block_device_mapping_handler(self):
          
          mapping_counter = 1
          mapping_device_name_fmt = 'BlockDeviceMapping.%s.DeviceName'
          mapping_del_on_term_fmt = '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 'true' == del_on_term_value_str else False
              device_name_value = self.querystring[mapping_device_name][0]
  
              instance_id = self._get_param('InstanceId')
              instance = self.ec2_backend.get_instance(instance_id)
  
              if self.is_not_dryrun('ModifyInstanceAttribute'):
                  block_device_type = instance.block_device_mapping[
                      device_name_value]
                  block_device_type.delete_on_termination = del_on_term_value
  
              # +1 for the next device
              mapping_counter += 1
  
          if mapping_counter > 1:
              return EC2_MODIFY_INSTANCE_ATTRIBUTE
docs: Handles requests which are generated by code similar to:
  
              instance.modify_attribute(
                  BlockDeviceMappings=[{
                      'DeviceName': '/dev/sda1',
                      'Ebs': {'DeleteOnTermination': 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.