code: def _get_error_context(input_, token):
      
  
      try:
          line = input_[token.lexpos: input_.index('\n', token.lexpos)]
      except ValueError:
          line = input_[token.lexpos:]
  
      i = input_.rfind('\n', 0, token.lexpos)
      if i < 0:
          i = 0
      line = input_[i:token.lexpos] + line
      lines = [line.strip('\r\n')]
      col = token.lexpos - i
      while len(lines) < 5 and i > 0:
          end = i
          i = input_.rfind('\n', 0, i)
          if i < 0:
              i = 0
          lines.insert(0, input_[i:end].strip('\r\n'))
      pointer = ''
      for dummy_ch in str(token.value):
          pointer += '^'
      pointline = ''
      i = 0
      while i < col - 1:
          if lines[-1][i].isspace():
              pointline += lines[-1][i]
              # otherwise, tabs complicate the alignment
          else:
              pointline += ' '
          i += 1
      lines.append(pointline + pointer)
      return lines
docs: Build a context string that defines where on the line the defined
          error occurs.  This consists of the characters ^ at the position
          and for the length defined by the lexer position and token length