def _get_answer(context, context_words, answer_start, answer_end):
  """Get answer given context, context_words, and span.

  Args:
    context: A list of bytes, to be decoded with utf-8.
    context_words: A list of a list of bytes, to be decoded with utf-8.
    answer_start: An int for answer start.
    answer_end: An int for answer end.
  Returns:
    A list of bytes, encoded with utf-8, for the answer.
  """
  context = context.decode('utf-8')
  context_words = [word.decode('utf-8') for word in context_words]
  pos = 0
  answer_start_char = None
  answer_end_char = None
  for i, word in enumerate(context_words):
    pos = context.index(word, pos)
    if answer_start == i:
      answer_start_char = pos
    pos += len(word)
    if answer_end == i:
      answer_end_char = pos
      break
  assert answer_start_char is not None, (
      '`answer_start` is not found in context. '
      'context=`%s`, context_words=`%r`, '
      'answer_start=%d, answer_end=%d') % (context, context_words, answer_start,
                                           answer_end)
  assert answer_end_char is not None, (
      '`answer_end` is not found in context. '
      'context=`%s`, context_words=`%r`, '
      'answer_start=%d, answer_end=%d') % (context, context_words, answer_start,
                                           answer_end)
  answer = context[answer_start_char:answer_end_char].encode('utf-8')
  return answer