code: def _add_spin_magnitudes(self, structure):
          
          for idx, site in enumerate(structure):
              if getattr(site.specie, '_properties', None):
                  spin = site.specie._properties.get('spin', None)
                  sign = int(spin) if spin else 0
                  if spin:
                      new_properties = site.specie._properties.copy()
                      # this very hacky bit of code only works because we know
                      # that on disordered sites in this class, all species are the same
                      # but have different spins, and this is comma-delimited
                      sp = str(site.specie).split(",")[0]
                      new_properties.update({
                          'spin': sign * self.mag_species_spin.get(sp, 0)
                      })
                      new_specie = Specie(site.specie.symbol,
                                          getattr(site.specie, 'oxi_state', None),
                                          new_properties)
                      structure.replace(idx, new_specie,
                                        properties=site.properties)
          logger.debug('Structure with spin magnitudes:\n{}'.format(str(structure)))
          return structure
docs: Replaces Spin.up/Spin.down with spin magnitudes specified
          by mag_species_spin.
          :param structure:
          :return: