nodes: 0, module; 1, function_definition; 2, function_name:_get_sorted_inputs; 3, parameters; 4, block; 5, identifier:filename; 6, expression_statement; 7, with_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, return_statement; 14, comment:"""Read and sort lines from the file sorted by decreasing length.
  
    Args:
      filename: String name of file to read inputs from.
    Returns:
      Sorted list of inputs, and dictionary mapping original index->sorted index
      of each element.
    """; 15, with_clause; 16, block; 17, assignment; 18, assignment; 19, assignment; 20, assignment; 21, pattern_list; 22, call; 23, block; 24, expression_list; 25, with_item; 26, expression_statement; 27, expression_statement; 28, if_statement; 29, identifier:input_lens; 30, list_comprehension; 31, identifier:sorted_input_lens; 32, call; 33, identifier:sorted_inputs; 34, list; 35, identifier:sorted_keys; 36, dictionary; 37, identifier:i; 38, tuple_pattern; 39, identifier:enumerate; 40, argument_list; 41, expression_statement; 42, expression_statement; 43, identifier:sorted_inputs; 44, identifier:sorted_keys; 45, as_pattern; 46, assignment; 47, assignment; 48, not_operator; 49, block; 50, tuple; 51, for_in_clause; 52, identifier:sorted; 53, argument_list; 54, identifier:index; 55, identifier:_; 56, identifier:sorted_input_lens; 57, call; 58, assignment; 59, call; 60, as_pattern_target; 61, identifier:records; 62, call; 63, identifier:inputs; 64, list_comprehension; 65, subscript; 66, expression_statement; 67, identifier:i; 68, call; 69, pattern_list; 70, call; 71, identifier:input_lens; 72, keyword_argument; 73, keyword_argument; 74, attribute; 75, argument_list; 76, subscript; 77, identifier:i; 78, attribute; 79, argument_list; 80, identifier:f; 81, attribute; 82, argument_list; 83, call; 84, for_in_clause; 85, identifier:inputs; 86, unary_operator; 87, call; 88, identifier:len; 89, argument_list; 90, identifier:i; 91, identifier:line; 92, identifier:enumerate; 93, argument_list; 94, identifier:key; 95, lambda; 96, identifier:reverse; 97, True; 98, identifier:sorted_inputs; 99, identifier:append; 100, subscript; 101, identifier:sorted_keys; 102, identifier:index; 103, attribute; 104, identifier:Open; 105, identifier:filename; 106, call; 107, identifier:split; 108, string:"\n"; 109, attribute; 110, argument_list; 111, identifier:record; 112, identifier:records; 113, integer:1; 114, attribute; 115, argument_list; 116, call; 117, identifier:inputs; 118, lambda_parameters; 119, subscript; 120, identifier:inputs; 121, identifier:index; 122, identifier:tf; 123, identifier:gfile; 124, attribute; 125, argument_list; 126, identifier:record; 127, identifier:strip; 128, identifier:inputs; 129, identifier:pop; 130, attribute; 131, argument_list; 132, identifier:x; 133, identifier:x; 134, integer:1; 135, identifier:f; 136, identifier:read; 137, identifier:line; 138, identifier:split
code: def _get_sorted_inputs(filename):
    """Read and sort lines from the file sorted by decreasing length.
  
    Args:
      filename: String name of file to read inputs from.
    Returns:
      Sorted list of inputs, and dictionary mapping original index->sorted index
      of each element.
    """
    with tf.gfile.Open(filename) as f:
      records = f.read().split("\n")
      inputs = [record.strip() for record in records]
      if not inputs[-1]:
        inputs.pop()
  
    input_lens = [(i, len(line.split())) for i, line in enumerate(inputs)]
    sorted_input_lens = sorted(input_lens, key=lambda x: x[1], reverse=True)
  
    sorted_inputs = []
    sorted_keys = {}
    for i, (index, _) in enumerate(sorted_input_lens):
      sorted_inputs.append(inputs[index])
      sorted_keys[index] = i
    return sorted_inputs, sorted_keys