code: def sort_potentials(potentials, use_copy=True):
      
  
      if use_copy:
          potentials = copy.deepcopy(potentials)
  
      # Sort by increasing AM, then move the last element to the front
      potentials = list(sorted(potentials, key=lambda x: x['angular_momentum']))
      potentials.insert(0, potentials.pop())
      return potentials
docs: Sort a list of ECP potentials into a standard order
  
      The order within a potential is not modified.
  
      The order of the shell list is in increasing angular momentum, with the largest
      angular momentum being moved to the front.
  
      If use_copy is True, the input potentials are not modified.