def METHOD_NAME(self, inputs, weights, training: tf.constant):
    """
    Apply rb sparsity mask to given weights.
    :param inputs: Target weights to sparsify.
    :param weights: Operation weights contains
        `mask` and param `trainable`.
    :param training: True if operation called in training mode
        else False
    """
    true_fn = lambda: apply_mask(inputs, self._calc_rb_binary_mask(weights))
    false_fn = lambda: apply_mask(inputs, binary_mask(weights["mask"]))
    return tf_internals.smart_cond(
        training,
        true_fn=lambda: tf_internals.smart_cond(weights["trainable"], true_fn=true_fn, false_fn=false_fn),
        false_fn=false_fn,
    )