code: def clip(sig, low=-1., high=1.):
    
    if low is None:
      if high is None:
        return Stream(sig)
      return Stream(el if el < high else high for el in sig)
    if high is None:
      return Stream(el if el > low else low for el in sig)
    if high < low:
      raise ValueError("Higher clipping limit is smaller than lower one")
    return Stream(high if el > high else
                  (low if el < low else el) for el in sig)
docs: Clips the signal up to both a lower and a higher limit.
  
    Parameters
    ----------
    sig :
      The signal to be clipped, be it a Stream instance, a list or any iterable.
    low, high :
      Lower and higher clipping limit, "saturating" the input to them. Defaults
      to -1.0 and 1.0, respectively. These can be None when needed one-sided
      clipping. When both limits are set to None, the output will be a Stream
      that yields exactly the ``sig`` input data.
  
    Returns
    -------
    Clipped signal as a Stream instance.