    def filter(self, operation):
        """Filtering operations based on various criteria"""
        enabled = True

        if (
            len(self.operations_enabled)
            and operation.operation_kind not in self.operations_enabled
        ):
            return False
        # eliminate duplicates
        if str(operation) in self.operations_by_name.keys():
            return False
        # Filter based on list of valid substrings
        if len(self.kernel_names):
            name = str(operation)
            enabled = False

            # compare against the include list
            for name_substr in self.kernel_names:
                if self._filter_string_matches(name_substr, name):
                    enabled = True
                    break

            # compare against the exclude list
            for name_substr in self.ignore_kernels:
                if self._filter_string_matches(name_substr, name):
                    enabled = False
                    break

        if len(self.kernel_filter_list) > 0:
            enabled = False
            if self.filter_out_kernels(str(operation), self.kernel_filter_list):
                enabled = True

        # todo: filter based on compute data type
        return enabled
Filtering operations based on various criteria
python/aitemplate/utils/mk_ck_lib/manifest.py