code: def construct_double_input_tokens_and_segment_ids(
      input_tokens_a: List[str],
      input_tokens_b: List[str],
      tokenizer,
      feat_spec: FeaturizationSpec,
  ):
      """Create token and segment id sequences, apply truncation, add separator and class tokens.
  
      Args:
          input_tokens_a (List[str]): sequence of tokens in segment a.
          input_tokens_b (List[str]): sequence of tokens in segment b.
          tokenizer:
          feat_spec (FeaturizationSpec): Tokenization-related metadata.
  
      Returns:
          UnpaddedInputs: unpadded inputs with truncation applied and special tokens appended.
  
      """
      if feat_spec.sep_token_extra:
          maybe_extra_sep = [tokenizer.sep_token]
          maybe_extra_sep_segment_id = [feat_spec.sequence_a_segment_id]
          special_tokens_count = 4  # CLS, SEP-SEP, SEP
      else:
          maybe_extra_sep = []
          maybe_extra_sep_segment_id = []
          special_tokens_count = 3  # CLS, SEP, SEP
  
      input_tokens_a, input_tokens_b = truncate_sequences(
          tokens_ls=[input_tokens_a, input_tokens_b],
          max_length=feat_spec.max_seq_length - special_tokens_count,
      )
  
      unpadded_tokens = (
          input_tokens_a
          + [tokenizer.sep_token]
          + maybe_extra_sep
          + input_tokens_b
          + [tokenizer.sep_token]
      )
      unpadded_segment_ids = (
          [feat_spec.sequence_a_segment_id] * len(input_tokens_a)
          + [feat_spec.sequence_a_segment_id]
          + maybe_extra_sep_segment_id
          + [feat_spec.sequence_b_segment_id] * len(input_tokens_b)
          + [feat_spec.sequence_b_segment_id]
      )
      return add_cls_token(
          unpadded_tokens=unpadded_tokens,
          unpadded_segment_ids=unpadded_segment_ids,
          tokenizer=tokenizer,
          feat_spec=feat_spec,
      )
  
imports: import numpy
  from dataclasses import dataclass
  from typing import List, NamedTuple
  from jiant.tasks.core import FeaturizationSpec
  from jiant.tasks.utils import truncate_sequences, pad_to_max_seq_length
  from jiant.utils.python.datastructures import BiMap
label_desc: Use image node_id 4 for calling a global function with example usage: construct_double_input_tokens_and_segment_ids(input_tokens_a, input_tokens_b, tokenizer, feat_spec) and returns: add_cls_token