code: def truncate_seq_pair(
      tokens_a: List[int], tokens_b: List[int], max_length: int
  ) -> bool:
      """Truncate a seq pair in place so that their total length <= max_length.
      Args:
          tokens_a: first token sequence
          tokens_b: second token sequence
          max_length: truncated sequence length
      Returns:
          is_too_long: whether combined sequences exceed maximum sequence length
      """
      is_too_long = False
      # This is a simple heuristic which will always truncate the longer sequence
      # one token at a time. This makes more sense than truncating an equal percent
      # of tokens from each, since if one sequence is very short then each token
      # that's truncated likely contains more information than a longer sequence.
      while True:
          total_length = len(tokens_a) + len(tokens_b)
          if total_length <= max_length:
              break
          is_too_long = True
          if len(tokens_a) > len(tokens_b):
              tokens_a.pop()
          else:
              tokens_b.pop()
      return is_too_long
  
file_path: NeMo/nemo/collections/nlp/data/dialogue/input_example/sgd_input_example.py
imports: from typing import List
  from nemo.collections.nlp.data.dialogue.input_example.input_example import DialogueInputExample
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling a global function with example usage: truncate_seq_pair(tokens_a, tokens_b, max_length) and returns: is_too_long