def pull_out_valid_samples(
        self,
        x: np.ndarray,
        y: np.ndarray,
        sample_sizes: np.ndarray,
        automatically_append: bool = True,
        perturb_sizes: list[list[int]] | None = None,
        perturb_starts: list[list[int]] | None = None,
    ) -> (
        tuple[np.ndarray, np.ndarray, np.ndarray]
        | tuple[np.ndarray, np.ndarray, np.ndarray, list[list[int]], list[list[int]]]
    ):
        """
        Filters the input data for samples that can be made adversarial.

        :param x: Array with input data.
        :param y: Labels to make sure the benign files are zero masked.
        :param sample_sizes: The size of the original file, before it was padded to the input size required by MalConv
        :param automatically_append: Whether to automatically append extra spare perturbation at the end of the file.
        :param perturb_sizes: List of length batch size, each element is in itself a list containing
                              the size of the allowable perturbation region
        :param perturb_starts: List of length batch size, each element is in itself a list containing
                               the start of perturbation region.

        """
        initial_dtype = x.dtype

        perturbation_size = np.zeros(len(sample_sizes), dtype=int)
        for i, sample_size in enumerate(sample_sizes):
            if self.l_0 < 1:  # l0 is a fraction of the filesize
                perturbation_size[i] = int(sample_size * self.l_0)
            else:  # or l0 is interpreted as total perturbation size
                perturbation_size[i] = int(self.l_0)

        if perturb_sizes is not None and perturb_starts is not None:
            perturbation_size, perturb_sizes = self.compute_perturbation_regions(
                perturbation_size, perturb_sizes, automatically_append
            )

        y = self.check_valid_size(y, sample_sizes, perturbation_size)
        if perturb_sizes is not None and perturb_starts is not None:
            return self.pull_out_adversarial_malware(x, y, sample_sizes, initial_dtype, perturb_sizes, perturb_starts)

        return self.pull_out_adversarial_malware(x, y, sample_sizes, initial_dtype)

        Filters the input data for samples that can be made adversarial.

        :param x: Array with input data.
        :param y: Labels to make sure the benign files are zero masked.
        :param sample_sizes: The size of the original file, before it was padded to the input size required by MalConv
        :param automatically_append: Whether to automatically append extra spare perturbation at the end of the file.
        :param perturb_sizes: List of length batch size, each element is in itself a list containing
                              the size of the allowable perturbation region
        :param perturb_starts: List of length batch size, each element is in itself a list containing
                               the start of perturbation region.

        
art/attacks/evasion/pe_malware_attack.py