code: def _get_header_conversation_type_mask_role(source, special_tokens):
      END_SIGNAL = special_tokens["end_of_turn"]
      END_NAME_SIGNAL = special_tokens["end_of_name"]
  
      data_type = None
      if "type" in source:
          data_type = source["type"]
          if data_type is not None:
              assert (
                  data_type in TYPE_INSTRUCTION
              ), f"source type {data_type} not supported"
      # add end signal and concatenate together
      conversation = source["system"]
      if data_type is not None:
          if TYPE_INSTRUCTION[data_type] != "":
              conversation = (
                  conversation + "\n" + TYPE_INSTRUCTION[data_type]
              )
      mask_role = source.get("mask", "User")
      header = f"{special_tokens['system_turn_start']}{SYSTEM_TOKEN}{END_NAME_SIGNAL}{conversation}{END_SIGNAL}"
      conversation = _add_speaker_and_signal(
          header,
          source["conversations"],
          mask_role,
          data_type,
          special_tokens,
      )
      return header, conversation, data_type, mask_role
  
file_path: NeMo/nemo/collections/nlp/data/language_modeling/megatron/gpt_sft_chat_dataset.py
imports: import copy
  import torch
  from nemo.collections.common.tokenizers.tokenizer_spec import TokenizerSpec
  from nemo.collections.nlp.data.language_modeling.megatron.gpt_sft_dataset import GPTSFTDataset
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling a global function with example usage: _get_header_conversation_type_mask_role(source, special_tokens) and returns: header,  conversation,  data_type,  mask_role