code: def retag_tags(doc, pipelines, xpos):
      """
      Returns a list of list of tags for the items in doc
  
      doc can be anything which feeds into the pipeline(s)
      pipelines are a list of 1 or more retag pipelines
      if multiple pipelines are given, majority vote wins
      """
      tag_lists = []
      for pipeline in pipelines:
          doc = pipeline(doc)
          tag_lists.append(
              [
                  [x.xpos if xpos else x.upos for x in sentence.words]
                  for sentence in doc.sentences
              ]
          )
      # tag_lists: for N pipeline, S sentences
      # we now have N lists of S sentences each
      # for sentence in zip(*tag_lists): N lists of |s| tags for this given sentence s
      # for tag in zip(*sentence): N predicted tags.
      # most common one in the Counter will be chosen
      tag_lists = [
          [Counter(tag).most_common(1)[0][0] for tag in zip(*sentence)]
          for sentence in zip(*tag_lists)
      ]
      return tag_lists
  
file_path: stanza/stanza/models/constituency/utils.py
imports: from collections import Counter, deque
  import copy
  import logging
  import torch.nn
  from torch import optim
  from stanza.models.common.doc import TEXT, Document
  from stanza.utils.get_tqdm import get_tqdm
label_desc: Use image node_id 2 for calling a global function with example usage: retag_tags(doc, pipelines, xpos) and returns: tag_lists