code: def _set_opinion_term_polarity(terms_list):
      """Set opinion term polarity.
  
      Args:
          terms_list (list): list of opinion terms
      """
      first = terms_list[0]
      new_term = first.term
  
      positive_pol = 0
      negative_pol = 0
      pol = None
      for term in terms_list:
          try:
              pol = term.term_polarity
          except Exception as e:
              print("extracted_term missing term_polarity: " + str(e))
          if pol is not None:
              if pol == Polarity.POS:
                  positive_pol = positive_pol + 1
              if pol == Polarity.NEG:
                  negative_pol = negative_pol + 1
      new_term_polarity = Polarity.UNK
      if positive_pol >= negative_pol and positive_pol > 0:
          new_term_polarity = Polarity.POS
      elif negative_pol >= positive_pol and negative_pol > 0:
          new_term_polarity = Polarity.NEG
  
      return OpinionTerm(new_term, new_term_polarity)
  
imports: import copy
  import re
  import sys
  from os import PathLike
  from tqdm import tqdm
  from nlp_architect.models.absa import TRAIN_LEXICONS, LEXICONS_OUT
  from nlp_architect.models.absa import GENERIC_OP_LEX
  from nlp_architect.models.absa.inference.data_types import Polarity
  from nlp_architect.models.absa.train.data_types import AspectTerm, DepRelation, DepRelationTerm, LoadOpinionStopLists, LoadAspectStopLists, OpinionTerm, QualifiedTerm
  from nlp_architect.models.absa.train.rules import rule_1, rule_2, rule_3, rule_4, rule_5, rule_6
  from nlp_architect.models.absa.utils import _load_parsed_docs_from_dir, _write_final_opinion_lex, _load_lex_as_list_from_csv, read_generic_lex_from_file
label_desc: Use image node_id 5 for calling a global function with example usage: _set_opinion_term_polarity(terms_list) and returns: OpinionTerm