code: def from_halflife(cls, inputs, window_length, halflife, **kwargs):
          
          if halflife <= 0:
              raise ValueError(
                  "`span` must be a positive number. %s was passed." % halflife
              )
          decay_rate = exp(log(.5) / halflife)
          assert 0.0 < decay_rate <= 1.0
  
          return cls(
              inputs=inputs,
              window_length=window_length,
              decay_rate=decay_rate,
              **kwargs
          )
docs: Convenience constructor for passing ``decay_rate`` in terms of half
          life.
  
          Forwards ``decay_rate`` as ``exp(log(.5) / halflife)``.  This provides
          the behavior equivalent to passing `halflife` to pandas.ewma.
  
          Examples
          --------
          .. code-block:: python
  
              # Equivalent to:
              # my_ewma = EWMA(
              #    inputs=[EquityPricing.close],
              #    window_length=30,
              #    decay_rate=np.exp(np.log(0.5) / 15),
              # )
              my_ewma = EWMA.from_halflife(
                  inputs=[EquityPricing.close],
                  window_length=30,
                  halflife=15,
              )
  
          Notes
          -----
          This classmethod is provided by both
          :class:`ExponentialWeightedMovingAverage` and
          :class:`ExponentialWeightedMovingStdDev`.