code: def get_densities(self, spin=None):
          
          if self.densities is None:
              result = None
          elif spin is None:
              if Spin.down in self.densities:
                  result = self.densities[Spin.up] + self.densities[Spin.down]
              else:
                  result = self.densities[Spin.up]
          else:
              result = self.densities[spin]
          return result
docs: Returns the density of states for a particular spin.
  
          Args:
              spin: Spin
  
          Returns:
              Returns the density of states for a particular spin. If Spin is
              None, the sum of all spins is returned.