code: def _create_long_answer_from_span_html(example):
      """
      Creates a list of long answer candidates, from their spans on the document.
  
      This function gets the full article from the input example dictionary (using
      key 'document_html'), then iterates through the long answer spans (from
      'long_answer_candidates' key) and creates a list of slices from the article,
      using the 'start_byte' and 'end_byte' values in the list of long answer
      candidate spans.
  
      Returns a list of long answers. Each long answer is a substring from the
          original HTML text.
  
      :param example: a dict that contains one example/entry from NQ dataset.
      """
      context_text = example[_context_type_key(is_html=True)].encode()
      candidate_long_answers = []
      for long_answer_span in example["long_answer_candidates"]:
          start_index = long_answer_span["start_byte"]
          end_index = long_answer_span["end_byte"]
          answer = context_text[start_index:end_index].decode()
          candidate_long_answers.append(answer)
      return candidate_long_answers
  
imports: import copy
  import os
  import json
  import jsonlines
  from typing import List, Optional, Tuple
  from parlai.core.teachers import ChunkTeacher, DialogTeacher
  from .build import build, DATASET_NAME_LOCAL, build_sample
  from .build_open import build
  from .utils.text_utils import simplify_nq_example
  from parlai.core.opt import Opt
  from parlai.core.message import Message
  from parlai.core.metrics import ExactMatchMetric, normalize_answer, AverageMetric
  from parlai.core.params import ParlaiParser
  from parlai.utils.data import DatatypeHelper
  from parlai.utils.io import PathManager
  import parlai.utils.logging
label_desc: Use image node_id 3 for calling a global function with example usage: _create_long_answer_from_span_html(example) and returns: candidate_long_answers