nodes: 0, module; 1, function_definition; 2, function_name:sorted_maybe_numeric; 3, parameters; 4, block; 5, identifier:x; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, comment:"""
      Sorts x with numeric semantics if all keys are nonnegative integers.
      Otherwise uses standard string sorting.
      """; 10, assignment; 11, identifier:all_numeric; 12, block; 13, else_clause; 14, identifier:all_numeric; 15, call; 16, return_statement; 17, block; 18, identifier:all; 19, argument_list; 20, call; 21, return_statement; 22, call; 23, identifier:sorted; 24, argument_list; 25, call; 26, identifier:map; 27, argument_list; 28, identifier:x; 29, keyword_argument; 30, identifier:sorted; 31, argument_list; 32, attribute; 33, identifier:x; 34, identifier:key; 35, identifier:int; 36, identifier:x; 37, identifier:str; 38, identifier:isdigit
code: def sorted_maybe_numeric(x):
      """
      Sorts x with numeric semantics if all keys are nonnegative integers.
      Otherwise uses standard string sorting.
      """
      all_numeric = all(map(str.isdigit, x))
      if all_numeric:
          return sorted(x, key=int)
      else:
          return sorted(x)