code: def unconsume_and_reconstruct_input(remaining_text, recognized_tokens, complex_value_idx):
          
          # Default slicing index: i.e. at most 3 elements will be unconsumed, Keyword, Whitespace and ComplexValue.
          slicing_start_idx = 2
  
          # Check whether the 3rd element from the end is an InspireKeyword. If not, a Value query with ComplexValue
          # was consumed.
          if not INSPIRE_PARSER_KEYWORDS.get(recognized_tokens[complex_value_idx - slicing_start_idx].value, None):
              slicing_start_idx = 1
  
          reconstructed_terminals = recognized_tokens[:complex_value_idx - slicing_start_idx]
          reconstructed_text = '{} {}'.format(
              ''.join([token.value for token in recognized_tokens[complex_value_idx - slicing_start_idx:]]),
              remaining_text
          )
          return reconstructed_text, reconstructed_terminals
docs: Reconstruct input in case of consuming a keyword query or a value query with ComplexValue as value.
  
          Un-consuming at most 3 elements and specifically (Keyword,) Whitespace and ComplexValue, while also
          reconstructing parser's input text.
  
          Example:
              Given this query "author foo t 'bar'", r would be:
                  r = [SimpleValueUnit("foo"), Whitespace(" "), SimpleValueUnit("t"), Whitespace(" "),
                      SimpleValueUnit("'bar'")]
              thus after this method, r would be [SimpleValueUnit("foo"), Whitespace(" ")], while initial text will
              have been reconstructed as "t 'bar' rest_of_the_text".