def filter_networks(self, predicate):
allele_to_allele_specific_models = {}<EOL>for (allele, models) in self.allele_to_allele_specific_models.items():<EOL><INDENT>allele_to_allele_specific_models[allele] = [<EOL>m for m in models if predicate(m)<EOL>]<EOL><DEDENT>class1_pan_allele_models = [<EOL>m for m in self.class1_pan_allele_models if predicate(m)<EOL>]<EOL>return Class1AffinityPredictor(<EOL>allele_to_allele_specific_models=allele_to_allele_specific_models,<EOL>class1_pan_allele_models=class1_pan_allele_models,<EOL>allele_to_fixed_length_sequence=self.allele_to_fixed_length_sequence,<EOL>)<EOL>
Return a new Class1AffinityPredictor containing a subset of this
predictor's neural networks.

Parameters
----------
predicate : Class1NeuralNetwork -> boolean
    Function specifying which neural networks to include

Returns
-------
Class1AffinityPredictor