code: def get_sentence_pair(doc, all_baskets, idx, prob_next_sentence=0.5):
      """
      Get one sample from corpus consisting of two sentences. With prob. 50% these are two subsequent sentences
      from one doc. With 50% the second sentence will be a random one from another doc.
  
      :param doc: The current document
      :param all_baskets: SampleBaskets containing multiple other docs from which we can sample the second sentence
      if we need a random one.
      :param idx: int, index of sample.
      :return: (str, str, int), sentence 1, sentence 2, isNextSentence Label
      """
      sent_1, sent_2 = doc[idx], doc[idx + 1]
  
      if random.random() > prob_next_sentence:
          label = True
      else:
          sent_2 = _get_random_sentence(all_baskets, forbidden_doc=doc)
          label = False
  
      assert len(sent_1) > 0
      assert len(sent_2) > 0
      return sent_1, sent_2, label
  
imports: import hashlib
  import json
  import logging
  import os
  import random
  import tarfile
  import tempfile
  import string
  import uuid
  from contextlib import ExitStack
  from itertools import islice
  from pathlib import Path
  import pandas
  from requests import get
  from tqdm import tqdm
  from typing import List
  from farm.file_utils import http_get
  from farm.modeling.tokenization import tokenize_with_metadata
label_desc: Use image node_id 16 for calling a global function with example usage: get_sentence_pair(doc, all_baskets, idx, prob_next_sentence) and returns: sent_1,  sent_2,  label