nodes: 0, module; 1, function_definition; 2, function_name:_get_sorting_message; 3, parameters; 4, block; 5, identifier:request; 6, identifier:key; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, if_statement; 12, return_statement; 13, comment:"""Parses the reverse query into a list of ClientSortControls protobuf
          messages.
          """; 14, assignment; 15, assignment; 16, comparison_operator:reverse is None; 17, block; 18, comparison_operator:reverse.lower() == ""; 19, block; 20, elif_clause; 21, identifier:control_list; 22, identifier:control_list; 23, list; 24, identifier:reverse; 25, call; 26, identifier:reverse; 27, None; 28, return_statement; 29, call; 30, string:""; 31, expression_statement; 32, comparison_operator:reverse.lower() != 'false'; 33, block; 34, attribute; 35, argument_list; 36, identifier:control_list; 37, attribute; 38, argument_list; 39, call; 40, call; 41, string; 42, expression_statement; 43, attribute; 44, identifier:get; 45, string; 46, None; 47, identifier:reverse; 48, identifier:lower; 49, attribute; 50, argument_list; 51, attribute; 52, argument_list; 53, string_content:false; 54, call; 55, attribute; 56, identifier:query; 57, string_content:reverse; 58, identifier:control_list; 59, identifier:append; 60, call; 61, identifier:reverse; 62, identifier:lower; 63, attribute; 64, argument_list; 65, identifier:request; 66, identifier:url; 67, attribute; 68, argument_list; 69, identifier:control_list; 70, identifier:append; 71, call; 72, identifier:client_list_control_pb2; 73, identifier:ClientSortControls; 74, keyword_argument; 75, keyword_argument; 76, attribute; 77, argument_list; 78, identifier:reverse; 79, True; 80, identifier:keys; 81, call; 82, identifier:client_list_control_pb2; 83, identifier:ClientSortControls; 84, keyword_argument; 85, keyword_argument; 86, attribute; 87, argument_list; 88, identifier:reverse; 89, True; 90, identifier:keys; 91, call; 92, identifier:key; 93, identifier:split; 94, string:","; 95, attribute; 96, argument_list; 97, identifier:reverse; 98, identifier:split; 99, string:","
code: def _get_sorting_message(request, key):
          """Parses the reverse query into a list of ClientSortControls protobuf
          messages.
          """
          control_list = []
          reverse = request.url.query.get('reverse', None)
          if reverse is None:
              return control_list
  
          if reverse.lower() == "":
              control_list.append(client_list_control_pb2.ClientSortControls(
                  reverse=True,
                  keys=key.split(",")
              ))
          elif reverse.lower() != 'false':
              control_list.append(client_list_control_pb2.ClientSortControls(
                  reverse=True,
                  keys=reverse.split(",")
              ))
  
          return control_list