nodes: 0, module; 1, function_definition; 2, function_name:sort_diclist; 3, parameters; 4, block; 5, identifier:undecorated; 6, identifier:sort_on; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""
      Sort a list of dictionaries by the value in each
      dictionary for the sorting key
  
      Parameters
      ----------
      undecorated : list of dicts
      sort_on : str, numeric
          key that is present in all dicts to sort on
  
      Returns
      ---------
      ordered list of dicts
  
      Examples
      ---------
      >>> lst = [{'key1': 10, 'key2': 2}, {'key1': 1, 'key2': 20}]
      >>> sort_diclist(lst, 'key1')
      [{'key2': 20, 'key1': 1}, {'key2': 2, 'key1': 10}]
      >>> sort_diclist(lst, 'key2')
      [{'key2': 2, 'key1': 10}, {'key2': 20, 'key1': 1}]
      """; 12, assignment; 13, call; 14, list_comprehension; 15, identifier:decorated; 16, list_comprehension; 17, attribute; 18, argument_list; 19, subscript; 20, for_in_clause; 21, tuple; 22, for_in_clause; 23, identifier:decorated; 24, identifier:sort; 25, identifier:undecorated; 26, identifier:index; 27, tuple_pattern; 28, identifier:decorated; 29, conditional_expression:len(dict_[sort_on]) if hasattr(dict_[sort_on], '__len__') else dict_[
                    sort_on]; 30, identifier:index; 31, tuple_pattern; 32, call; 33, identifier:key; 34, identifier:index; 35, call; 36, call; 37, subscript; 38, identifier:index; 39, identifier:dict_; 40, identifier:enumerate; 41, argument_list; 42, identifier:len; 43, argument_list; 44, identifier:hasattr; 45, argument_list; 46, identifier:dict_; 47, identifier:sort_on; 48, identifier:undecorated; 49, subscript; 50, subscript; 51, string; 52, identifier:dict_; 53, identifier:sort_on; 54, identifier:dict_; 55, identifier:sort_on; 56, string_content:__len__
code: def sort_diclist(undecorated, sort_on):
      """
      Sort a list of dictionaries by the value in each
      dictionary for the sorting key
  
      Parameters
      ----------
      undecorated : list of dicts
      sort_on : str, numeric
          key that is present in all dicts to sort on
  
      Returns
      ---------
      ordered list of dicts
  
      Examples
      ---------
      >>> lst = [{'key1': 10, 'key2': 2}, {'key1': 1, 'key2': 20}]
      >>> sort_diclist(lst, 'key1')
      [{'key2': 20, 'key1': 1}, {'key2': 2, 'key1': 10}]
      >>> sort_diclist(lst, 'key2')
      [{'key2': 2, 'key1': 10}, {'key2': 20, 'key1': 1}]
      """
      decorated = [(len(dict_[sort_on]) if hasattr(dict_[sort_on], '__len__') else dict_[
                    sort_on], index) for (index, dict_) in enumerate(undecorated)]
      decorated.sort()
      return[undecorated[index] for (key, index) in decorated]