code: def to_int(string, ignore_error=False):
      try:
          res = int(string)
      except ValueError as err:
          if ignore_error:
              return 0
          else:
              raise err
      return res
  
imports: import random
  import logging
  import torch
  from stanza.models.common.bert_embedding import filter_data
  from stanza.models.common.data import map_to_ids, get_long_tensor, get_float_tensor, sort_all
  from stanza.models.common.vocab import PAD_ID, VOCAB_PREFIX, ROOT_ID, CompositeVocab, CharVocab
  from stanza.models.pos.vocab import WordVocab, XPOSVocab, FeatureVocab, MultiVocab
  from stanza.models.pos.xpos_vocab_factory import xpos_vocab_factory
  from stanza.models.common.doc import *
label_desc: Use image node_id 2 for calling a global function with example usage: to_int(string, ignore_error) and returns: res, int