code: def add_cls_token(
      unpadded_tokens: List[str],
      unpadded_segment_ids: List[int],
      tokenizer,
      feat_spec: FeaturizationSpec,
  ):
      """Add class token to unpadded inputs.
  
      Applies class token to end (or start) of unpadded inputs depending on FeaturizationSpec.
  
      Args:
          unpadded_tokens (List[str]): sequence of unpadded token strings.
          unpadded_segment_ids (List[str]): sequence of unpadded segment ids.
          tokenizer:
          feat_spec (FeaturizationSpec): Tokenization-related metadata.
  
      Returns:
          UnpaddedInputs: unpadded inputs with class token appended.
  
      """
      if feat_spec.cls_token_at_end:
          return UnpaddedInputs(
              unpadded_tokens=unpadded_tokens + [tokenizer.cls_token],
              unpadded_segment_ids=unpadded_segment_ids
              + [feat_spec.cls_token_segment_id],
              cls_offset=0,
          )
      else:
          return UnpaddedInputs(
              unpadded_tokens=[tokenizer.cls_token] + unpadded_tokens,
              unpadded_segment_ids=[feat_spec.cls_token_segment_id]
              + unpadded_segment_ids,
              cls_offset=1,
          )
  
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 5 for calling a global function with example usage: add_cls_token(unpadded_tokens, unpadded_segment_ids, tokenizer, feat_spec) and returns: UnpaddedInputs, UnpaddedInputs