code: def _split_multiline_prompt(get_prompt_tokens):
      
      def has_before_tokens(cli):
          for token, char in get_prompt_tokens(cli):
              if '\n' in char:
                  return True
          return False
  
      def before(cli):
          result = []
          found_nl = False
          for token, char in reversed(explode_tokens(get_prompt_tokens(cli))):
              if found_nl:
                  result.insert(0, (token, char))
              elif char == '\n':
                  found_nl = True
          return result
  
      def first_input_line(cli):
          result = []
          for token, char in reversed(explode_tokens(get_prompt_tokens(cli))):
              if char == '\n':
                  break
              else:
                  result.insert(0, (token, char))
          return result
  
      return has_before_tokens, before, first_input_line
docs: Take a `get_prompt_tokens` function and return three new functions instead.
      One that tells whether this prompt consists of multiple lines; one that
      returns the tokens to be shown on the lines above the input; and another
      one with the tokens to be shown at the first line of the input.