def check_valid_size(
        self,
        y: np.ndarray,
        sample_sizes: np.ndarray,
        append_perturbation_size: np.ndarray,
    ) -> np.ndarray:
        """
        Checks that we can append the l0 perturbation to the malware sample and not exceed the
        maximum file size. A new label vector with just the valid files indicated is created.

        :param y: Labels.
        :param sample_sizes: The size of the original file, before it was padded to the input size required by MalConv.
        :param append_perturbation_size: Size of the perturbations in L0 terms to put at end of file.
        :return adv_label_vector: Labels which indicate which malware samples have enough free features to
                                  accommodate all the adversarial perturbation.
        """

        adv_label_vector = np.zeros_like(y)
        for i, label in enumerate(y):
            if label == 1:
                if sample_sizes[i] + append_perturbation_size[i] <= self.param_dic["maxlen"]:
                    adv_label_vector[i] = 1
                    logger.info("size to append on sample %d is %d", i, append_perturbation_size[i])

        return adv_label_vector

        Checks that we can append the l0 perturbation to the malware sample and not exceed the
        maximum file size. A new label vector with just the valid files indicated is created.

        :param y: Labels.
        :param sample_sizes: The size of the original file, before it was padded to the input size required by MalConv.
        :param append_perturbation_size: Size of the perturbations in L0 terms to put at end of file.
        :return adv_label_vector: Labels which indicate which malware samples have enough free features to
                                  accommodate all the adversarial perturbation.
        
art/attacks/evasion/pe_malware_attack.py