'Unregister an AMI.
:type image_id: string
:param image_id: the ID of the Image to unregister
:type delete_snapshot: bool
:param delete_snapshot: Set to True if we should delete the
snapshot associated with an EBS volume mounted at /dev/sda1
:type dry_run: bool
:param dry_run: Set to True if the operation should not actually run.
:rtype: bool
:return: True if successful'

def deregister_image(self, image_id, delete_snapshot=False, dry_run=False):

    snapshot_id = None
    if delete_snapshot:
        image = self.get_image(image_id)
        for key in image.block_device_mapping:
            if (key == '/dev/sda1'):
                snapshot_id = image.block_device_mapping[key].snapshot_id
                break
    params = {'ImageId': image_id}
    if dry_run:
        params['DryRun'] = 'true'
    result = self.get_status('DeregisterImage', params, verb='POST')
    if (result and snapshot_id):
        return (result and self.delete_snapshot(snapshot_id))
    return result
