code: def text_sort_key(ex):
      """Sort using the number of tokens in the sequence."""
      if ex["tgt"]:
          return len(ex["src"]["src_ids"]), len(ex["tgt"]["tgt_ids"])
      return len(ex["src"]["src_ids"])
  
file_path: OpenNMT-py/onmt/inputters/text_utils.py
imports: import torch
  import pyonmttok
  from onmt.constants import DefaultTokens, CorpusTask, ModelTask
  from torch.nn.utils.rnn import pad_sequence
  from onmt.utils.logging import logger
  from collections import Counter
label_desc: Use image node_id 3 for calling a global function with example usage: text_sort_key(ex) and returns: len, len,  len