code: def get_best_span_index(doc_spans, position):
      """
      For a particular position, identify which doc_span gives the most context around token
  
      Helper function for _check_is_max_context; see _check_is_max_context for more details
      """
      best_score = None
      best_span_index = None
      for span_index, doc_span in enumerate(doc_spans):
          end = doc_span.start + doc_span.length - 1
          if position < doc_span.start:
              continue
          if position > end:
              continue
          num_left_context = position - doc_span.start
          num_right_context = end - position
          score = (
              min(num_left_context, num_right_context)
              + 0.01 * doc_span.length
          )
          if best_score is None or score > best_score:
              best_score = score
              best_span_index = span_index
      return best_span_index
  
imports: import collections
  import os
  import pickle
  from functools import lru_cache
  from typing import Dict, List, Optional
  import numpy
  import psutil
  import torch
  from tqdm import trange
  from nemo.collections.common.parts.utils import _compute_softmax
  from nemo.collections.nlp.data.data_utils import is_whitespace
  from nemo.collections.nlp.data.question_answering_squad.qa_squad_processing import EVALUATION_MODE, INFERENCE_MODE, TRAINING_MODE, SquadProcessor, _improve_answer_span, apply_no_ans_threshold, exact_match_score, f1_score, find_all_best_thresh, get_best_indexes, get_final_text, make_eval_dict, merge_eval, normalize_answer
  from nemo.core.classes import Dataset
  from nemo.utils import logging
label_desc: Use image node_id 2 for calling a global function with example usage: get_best_span_index(doc_spans, position) and returns: best_span_index