code: def ordering(self):
          
  
          if not self.is_collinear:
              warnings.warn(
                  "Detecting ordering in non-collinear structures not yet implemented."
              )
              return Ordering.Unknown
  
          if "magmom" not in self.structure.site_properties:
              # maybe this was a non-spin-polarized calculation, or we've
              # lost the magnetic moment information
              return Ordering.Unknown
  
          magmoms = self.magmoms
  
          max_magmom = max(magmoms)
  
          total_magnetization = abs(sum(magmoms))
  
          is_potentially_ferromagnetic = np.all(magmoms >= 0) or np.all(magmoms <= 0)
  
          if total_magnetization > 0 and is_potentially_ferromagnetic:
              return Ordering.FM
          elif total_magnetization > 0:
              return Ordering.FiM
          elif max_magmom > 0:
              return Ordering.AFM
          else:
              return Ordering.NM
docs: Applies heuristics to return a magnetic ordering for a collinear
          magnetic structure. Result is not guaranteed for correctness.
          :return: Ordering Enum ('FiM' is used as the abbreviation for
          ferrimagnetic)