code: def sort_shells(shells, use_copy=True):
      
  
      if use_copy:
          shells = copy.deepcopy(shells)
  
      # Sort primitives within a shell
      # (copying already handled above)
      shells = [sort_shell(sh, False) for sh in shells]
  
      # Sort the list by increasing AM, then general contraction level, then decreasing highest exponent
      return list(
          sorted(
              shells,
              key=lambda x: (max(x['angular_momentum']), -len(x['exponents']), -len(x['coefficients']), -float(
                  max(x['exponents'])))))
docs: Sort a list of basis set shells into a standard order
  
      The order within a shell is by decreasing value of the exponent.
  
      The order of the shell list is in increasing angular momentum, and then
      by decreasing number of primitives, then decreasing value of the largest exponent.
  
      If use_copy is True, the input shells are not modified.