def METHOD_NAME(self, filter) -> List[Instance]:
    if not callable(filter):
        return []
    instances = []
    for instance in self.get_instances():
        if filter(instance):
            instances.append(instance)
    return instances