nodes: 0, module; 1, function_definition; 2, function_name:natural_sort; 3, parameters; 4, block; 5, identifier:list; 6, default_parameter; 7, expression_statement; 8, function_definition; 9, expression_statement; 10, expression_statement; 11, identifier:key; 12, lambda; 13, comment:"""
      Sort the list into natural alphanumeric order.
      """; 14, function_name:get_alphanum_key_func; 15, parameters; 16, block; 17, assignment; 18, call; 19, lambda_parameters; 20, identifier:s; 21, identifier:key; 22, expression_statement; 23, return_statement; 24, identifier:sort_key; 25, call; 26, attribute; 27, argument_list; 28, identifier:s; 29, assignment; 30, lambda; 31, identifier:get_alphanum_key_func; 32, argument_list; 33, identifier:list; 34, identifier:sort; 35, keyword_argument; 36, identifier:convert; 37, lambda; 38, lambda_parameters; 39, list_comprehension; 40, identifier:key; 41, identifier:key; 42, identifier:sort_key; 43, lambda_parameters; 44, conditional_expression:int(text) if text.isdigit() else text; 45, identifier:s; 46, call; 47, for_in_clause; 48, identifier:text; 49, call; 50, call; 51, identifier:text; 52, identifier:convert; 53, argument_list; 54, identifier:c; 55, call; 56, identifier:int; 57, argument_list; 58, attribute; 59, argument_list; 60, identifier:c; 61, attribute; 62, argument_list; 63, identifier:text; 64, identifier:text; 65, identifier:isdigit; 66, identifier:re; 67, identifier:split; 68, string; 69, call; 70, string_content:([0-9]+); 71, identifier:key; 72, argument_list; 73, identifier:s
code: def natural_sort(list, key=lambda s:s):
      """
      Sort the list into natural alphanumeric order.
      """
      def get_alphanum_key_func(key):
          convert = lambda text: int(text) if text.isdigit() else text
          return lambda s: [convert(c) for c in re.split('([0-9]+)', key(s))]
      sort_key = get_alphanum_key_func(key)
      list.sort(key=sort_key)