Create or update a Tag related to a post.

        :param bulk_mode: If True, minimize db operations by bulk creating post objects
        :param api_tag: the API data for the Tag
        :return: the Tag object

def process_post_tag(self, bulk_mode, api_tag):
        """
        Create or update a Tag related to a post.

        :param bulk_mode: If True, minimize db operations by bulk creating post objects
        :param api_tag: the API data for the Tag
        :return: the Tag object
        """
        tag = None

        # try to get from the ref data map if in bulk mode
        if bulk_mode:
            tag = self.ref_data_map["tags"].get(api_tag["ID"])

        # double check the db before giving up, we may have sync'd it in a previous run
        if not tag:
            tag, created = Tag.objects.get_or_create(site_id=self.site_id,
                                                     wp_id=api_tag["ID"],
                                                     defaults=self.api_object_data("tag", api_tag))
            if tag and not created:
                self.update_existing_tag(tag, api_tag)

            # add to ref data map so later lookups work
            if tag:
                self.ref_data_map["tags"][api_tag["ID"]] = tag

        return tag