def _sample_data(x: np.ndarray, y: np.ndarray, action: int) -> np.ndarray:
        """
        Sample data with a specific action.

        :param x: An array with the source input to the victim classifier.
        :param y: Target values (class labels) one-hot-encoded of shape (nb_samples, nb_classes) or indices of shape
                  (nb_samples,).
        :param action: The action index returned from the action sampling.
        :return: An array with one input to the victim classifier.
        """
        if len(y.shape) == 2:
            y_index = np.argmax(y, axis=1)
        else:
            y_index = y

        x_index = x[y_index == action]
        rnd_idx = np.random.choice(len(x_index))

        return x_index[rnd_idx]

        Sample data with a specific action.

        :param x: An array with the source input to the victim classifier.
        :param y: Target values (class labels) one-hot-encoded of shape (nb_samples, nb_classes) or indices of shape
                  (nb_samples,).
        :param action: The action index returned from the action sampling.
        :return: An array with one input to the victim classifier.
        
art/attacks/extraction/knockoff_nets.py