<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def matches(self, properties):
 """ Tests if the given properties matches this LDAP filter and its children :param properties: A dictionary of properties :return: True if the properties matches this filter, else False """

        # Use a generator, and declare it outside of the method call
        # => seems to be quite a speed up trick
        generator = (
            criterion.matches(properties) for criterion in self.subfilters
        )

        # Extract "if" from loops and use built-in methods
        if self.operator == OR:
            result = any(generator)
        else:
            result = all(generator)
            if self.operator == NOT:
                # Revert result
                return not result

        return result