nodes: 0, module; 1, function_definition; 2, function_name:sort_basis; 3, parameters; 4, block; 5, identifier:basis; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, for_statement; 10, return_statement; 11, identifier:use_copy; 12, True; 13, comment:"""
      Sorts all the information in a basis set into a standard order
  
      If use_copy is True, the input basis set is not modified.
      """; 14, identifier:use_copy; 15, block; 16, pattern_list; 17, call; 18, block; 19, call; 20, expression_statement; 21, identifier:k; 22, identifier:el; 23, attribute; 24, argument_list; 25, if_statement; 26, if_statement; 27, identifier:sort_basis_dict; 28, argument_list; 29, assignment; 30, subscript; 31, identifier:items; 32, comparison_operator:'electron_shells' in el; 33, block; 34, comparison_operator:'ecp_potentials' in el; 35, block; 36, identifier:basis; 37, identifier:basis; 38, call; 39, identifier:basis; 40, string; 41, string; 42, identifier:el; 43, expression_statement; 44, string; 45, identifier:el; 46, expression_statement; 47, attribute; 48, argument_list; 49, string_content:elements; 50, string_content:electron_shells; 51, assignment; 52, string_content:ecp_potentials; 53, assignment; 54, identifier:copy; 55, identifier:deepcopy; 56, identifier:basis; 57, subscript; 58, call; 59, subscript; 60, call; 61, identifier:el; 62, string; 63, identifier:sort_shells; 64, argument_list; 65, identifier:el; 66, string; 67, identifier:sort_potentials; 68, argument_list; 69, string_content:electron_shells; 70, subscript; 71, False; 72, string_content:ecp_potentials; 73, subscript; 74, False; 75, identifier:el; 76, string; 77, identifier:el; 78, string; 79, string_content:electron_shells; 80, string_content:ecp_potentials
code: def sort_basis(basis, use_copy=True):
      """
      Sorts all the information in a basis set into a standard order
  
      If use_copy is True, the input basis set is not modified.
      """
  
      if use_copy:
          basis = copy.deepcopy(basis)
  
      for k, el in basis['elements'].items():
          if 'electron_shells' in el:
              el['electron_shells'] = sort_shells(el['electron_shells'], False)
          if 'ecp_potentials' in el:
              el['ecp_potentials'] = sort_potentials(el['ecp_potentials'], False)
  
      return sort_basis_dict(basis)