def _shrinkage_threshold(z_batch: np.ndarray, x_batch: np.ndarray, beta: float) -> np.ndarray:
        """
        Implement the element-wise projected shrinkage-threshold function.

        :param z_batch: A batch of examples.
        :param x_batch: A batch of original examples.
        :param beta: The shrink parameter.
        :return: A shrinked version of z.
        """
        cond1 = (z_batch - x_batch) > beta
        cond2 = np.abs(z_batch - x_batch) <= beta
        cond3 = (z_batch - x_batch) < -beta

        upper = np.minimum(z_batch - beta, 1.0)
        lower = np.maximum(z_batch + beta, 0.0)
        result = cond1 * upper + cond2 * x_batch + cond3 * lower

        return result

        Implement the element-wise projected shrinkage-threshold function.

        :param z_batch: A batch of examples.
        :param x_batch: A batch of original examples.
        :param beta: The shrink parameter.
        :return: A shrinked version of z.
        
art/attacks/evasion/elastic_net.py