Clip a value to a bound.

        Parameters
        ----------
        value : scalar or ndarray
            value to clip

        Returns
        -------
        scalar or ndarray :
            of the same shape as value, bit with each element clipped to fall
            within the specified bounds

        Example
        -------
        >>> bnd = Bound(1, 2)
        >>> bnd.clip(1.5)
        1.5
        >>> bnd.clip(3)
        2
        >>> bnd.clip(np.array([1, 3, 1.5]))
        array([ 1. ,  2. ,  1.5])
        >>> bnd = Bound(None, None)
        >>> bnd.clip(np.array([1, 3, 1.5]))
        array([ 1. ,  3. ,  1.5])

def clip(self, value):
        """
        Clip a value to a bound.

        Parameters
        ----------
        value : scalar or ndarray
            value to clip

        Returns
        -------
        scalar or ndarray :
            of the same shape as value, bit with each element clipped to fall
            within the specified bounds

        Example
        -------
        >>> bnd = Bound(1, 2)
        >>> bnd.clip(1.5)
        1.5
        >>> bnd.clip(3)
        2
        >>> bnd.clip(np.array([1, 3, 1.5]))
        array([ 1. ,  2. ,  1.5])
        >>> bnd = Bound(None, None)
        >>> bnd.clip(np.array([1, 3, 1.5]))
        array([ 1. ,  3. ,  1.5])
        """
        if not self.lower and not self.upper:
            return value

        return np.clip(value, self.lower, self.upper)