a method for adding or updating tags on an AWS instance

        :param image_id: string with AWS id of instance
        :param tag_list: list of tags to add to instance
        :return: dictionary with response data

def tag_image(self, image_id, tag_list):

        '''
            a method for adding or updating tags on an AWS instance

        :param image_id: string with AWS id of instance
        :param tag_list: list of tags to add to instance
        :return: dictionary with response data
        '''

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

    # validate inputs
        input_fields = {
            'image_id': image_id,
            'tag_list': tag_list
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)
    
    # retrieve tag list of image
        self.iam.printer_on = False
        image_details = self.read_image(image_id)
        self.iam.printer_on = True
        old_tags = image_details['tags']
    
    # determine tags to remove
        delete_list = []
        tag_map = {}
        for tag in tag_list:
            tag_map[tag['key']] = tag['value']
        for tag in old_tags:
            if tag['key'] not in tag_map.keys():
                delete_list.append(tag)
            elif tag['value'] != tag_map[tag['key']]:
                delete_list.append(tag)

    # convert tag list to camelcase
        delete_list = self.iam.prepare(delete_list)
        tag_list = self.iam.prepare(tag_list)
    
    # remove tags from instance
        if delete_list:
            try:
                delete_kwargs = {
                    'Resources': [ image_id ],
                    'Tags': delete_list
                }
                self.connection.delete_tags(**delete_kwargs)
            except:
                AWSConnectionError(title)
            
    # tag instance with updated tags
        try:
            create_kwargs = {
                'Resources': [ image_id ],
                'Tags': tag_list
            }
            response = self.connection.create_tags(**create_kwargs)
        except:
            raise AWSConnectionError(title)

        return response