code: def get_sent_context(mention, key, solr_escaped=True):
      if not solr_escaped:
          mention_data_key = "sent_context_orig"
      else:
          mention_data_key = "sent_context"
  
      if key.endswith("next"):
          if key.endswith("prev_next"):
              res = "{} {} {}".format(
                  ""
                  if mention[mention_data_key][0] is None
                  else mention[mention_data_key][0],
                  mention[mention_data_key][1],
                  ""
                  if mention[mention_data_key][2] is None
                  else mention[mention_data_key][2],
              )
          else:
              res = "{} {}".format(
                  mention[mention_data_key][1],
                  ""
                  if mention[mention_data_key][2] is None
                  else mention[mention_data_key][2],
              )
      elif key.endswith("prev"):
          res = "{} {}".format(
              ""
              if mention[mention_data_key][0] is None
              else mention[mention_data_key][0],
              mention[mention_data_key][1],
          )
      else:
          res = mention[mention_data_key][1]
  
      return res.strip()
  
file_path: BLINK/blink/candidate_retrieval/utils.py
imports: import sys
  import pickle
  import subprocess
  import blink.candidate_retrieval.dataset
  import re
  import os
label_desc: Use image node_id 4 for calling a global function with example usage: get_sent_context(mention, key, solr_escaped) and returns: res