nodes: 0, module; 1, function_definition; 2, function_name:sort_orbitals; 3, parameters; 4, block; 5, identifier:element_pdos; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, comment:"""Sort the orbitals of an element's projected density of states.
  
      Sorts the orbitals based on a standard format. E.g. s < p < d.
      Will also sort lm decomposed orbitals. This is useful for plotting/saving.
  
      Args:
          element_pdos (dict): An element's pdos. Should be formatted as a
              :obj:`dict` of ``{orbital: dos}``. Where dos is a
              :obj:`~pymatgen.electronic_structure.dos.Dos` object. For example::
  
                  {'s': dos, 'px': dos}
  
      Returns:
          list: The sorted orbitals.
      """; 13, assignment; 14, assignment; 15, assignment; 16, identifier:key; 17, identifier:sorted_orbitals; 18, block; 19, identifier:sorted_keys; 20, identifier:sorted_orbitals; 21, list; 22, identifier:unsorted_keys; 23, call; 24, identifier:sorted_keys; 25, list; 26, if_statement; 27, string; 28, string; 29, string; 30, string; 31, string; 32, string; 33, string; 34, string; 35, string; 36, string; 37, string; 38, string; 39, string; 40, string; 41, string; 42, string; 43, string; 44, string; 45, string; 46, attribute; 47, argument_list; 48, comparison_operator:key in unsorted_keys; 49, block; 50, string_content:s; 51, string_content:p; 52, string_content:py; 53, string_content:pz; 54, string_content:px; 55, string_content:d; 56, string_content:dxy; 57, string_content:dyz; 58, string_content:dz2; 59, string_content:dxz; 60, string_content:dx2; 61, string_content:f; 62, string_content:f_3; 63, string_content:f_2; 64, string_content:f_1; 65, string_content:f_0; 66, string_content:f1; 67, string_content:f2; 68, string_content:f3; 69, identifier:element_pdos; 70, identifier:keys; 71, identifier:key; 72, identifier:unsorted_keys; 73, expression_statement; 74, call; 75, attribute; 76, argument_list; 77, identifier:sorted_keys; 78, identifier:append; 79, identifier:key
code: def sort_orbitals(element_pdos):
      """Sort the orbitals of an element's projected density of states.
  
      Sorts the orbitals based on a standard format. E.g. s < p < d.
      Will also sort lm decomposed orbitals. This is useful for plotting/saving.
  
      Args:
          element_pdos (dict): An element's pdos. Should be formatted as a
              :obj:`dict` of ``{orbital: dos}``. Where dos is a
              :obj:`~pymatgen.electronic_structure.dos.Dos` object. For example::
  
                  {'s': dos, 'px': dos}
  
      Returns:
          list: The sorted orbitals.
      """
      sorted_orbitals = ['s', 'p', 'py', 'pz', 'px',
                         'd', 'dxy', 'dyz', 'dz2', 'dxz', 'dx2',
                         'f', 'f_3', 'f_2', 'f_1', 'f_0', 'f1', 'f2', 'f3']
      unsorted_keys = element_pdos.keys()
  
      sorted_keys = []
      for key in sorted_orbitals:
          if key in unsorted_keys:
              sorted_keys.append(key)
  
      return sorted_keys