<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def delete_image(self, image_id):

        '''
            method for removing an image from AWS EC2

        :param image_id: string with AWS id of instance
        :return: string with AWS response from snapshot delete
        '''

        title = '%s.delete_image' % self.__class__.__name__

    # validate inputs
        input_fields = {
            'image_id': image_id
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)

    # report query
        self.iam.printer('Removing image %s from AWS region %s.' % (image_id, self.iam.region_name))

    # retrieve state
        old_state = self.check_image_state(image_id)

    # discover snapshot id and tags associated with instance id
        image_details = self.read_image(image_id)
        tag_list = image_details['tags']
        snapshot_id = image_details['snapshot_id']

    # remove tags from instance
        try:
            delete_kwargs = {
                'Resources': [ image_id ],
                'Tags': self.iam.prepare(tag_list)
            }
            self.connection.delete_tags(**delete_kwargs)
            self.iam.printer('Tags have been deleted from %s.' % image_id)
        except:
            raise AWSConnectionError(title)

    # deregister image
        try:
            self.connection.deregister_image(
                ImageId=image_id
            )
        except:
            raise AWSConnectionError(title)
        self.iam.printer('Image %s has been deregistered.' % image_id)

    # delete snapshot
        try:
            response = self.connection.delete_snapshot(
                SnapshotId=snapshot_id
            )
        except:
            raise AWSConnectionError(title)
        self.iam.printer('Snapshot %s associated with image %s has been deleted.' % (snapshot_id, image_id))

        return response