docstr: Given a mention and a list of sentences that follow the blink conventions, it returns a left and right context for the mention
docstr_tok: ["Given","a","mention","and","a","list","of","sentences","that","follow","the","blink","conventions",",","it","returns","a","left","and","right","context","for","the","mention"]
code: def _get_mention_context_end2end(mention, sentences):
      """Given a mention and a list of sentences that follow the blink conventions, it returns a left and right context for the mention"""
      sent_idx = mention["sent_idx"]
  
      prev_sent = sentences[sent_idx - 1] if sent_idx > 0 else ""
      next_sent = (
          sentences[sent_idx + 1]
          if sent_idx + 1 < len(sentences)
          else ""
      )
      prev_sent = sentences[sent_idx - 1] if False else ""
      next_sent = sentences[sent_idx + 1] if False else ""
      sent = sentences[sent_idx]
  
      curr_sent_prev = sent[: mention["start_pos"]].strip()
      curr_sent_next = sent[mention["end_pos"] :].strip()
  
      left_context = "{} {}".format(prev_sent, curr_sent_prev).strip()
      right_context = "{} {}".format(curr_sent_next, next_sent).strip()
  
      return (left_context, right_context)
  
imports: import torch
  import os
  import numpy
  from pytorch_transformers.modeling_bert import BertPreTrainedModel, BertConfig, BertModel
  from pytorch_transformers.tokenization_bert import BertTokenizer
  from torch.utils.data import DataLoader, SequentialSampler, TensorDataset
  from torch import nn
  from torch.nn import CrossEntropyLoss, MSELoss
  from tqdm import tqdm
  from pytorch_transformers.optimization import AdamW, WarmupLinearSchedule
  from pytorch_transformers.file_utils import PYTORCH_PRETRAINED_BERT_CACHE
label_desc: Use image node_id 7 for calling the BertReranker obj's underlying member method code with example usage: obj._get_mention_context_end2end(mention, sentences) and returns: left_context,  right_context