docs: def as_smearing(cls, obj):
          """
          Constructs an instance of `Smearing` from obj. Accepts obj in the form:
  
              * Smearing instance
              * "name:tsmear"  e.g. "gaussian:0.004"  (Hartree units)
              * "name:tsmear units" e.g. "gaussian:0.1 eV"
              * None --> no smearing
          """
          if obj is None:
              return Smearing.nosmearing()
  
          if isinstance(obj, cls):
              return obj
  
          # obj is a string
          if obj == "nosmearing":
              return cls.nosmearing()
          else:
              obj, tsmear = obj.split(":")
              obj.strip()
  
              occopt = cls._mode2occopt[obj]
              try:
                  tsmear = float(tsmear)
              except ValueError:
                  tsmear, unit = tsmear.split()
                  tsmear = units.Energy(float(tsmear), unit).to("Ha")
  
              return cls(occopt, tsmear)