@dispatch.multimethod<EOL>def normalize(expr):
_ = expr<EOL>raise NotImplementedError()<EOL>
Optimizes the AST for better performance and simpler structure.

    The returned query will be logically equivalent to what was provided but
    transformations will be made to flatten and optimize the structure. This
    works by recognizing certain patterns and replacing them with nicer ones,
    eliminating pointless expressions, and so on.

    # Collapsing nested variadic expressions:

    Example:
        Intersection(x, Interestion(y, z)) => Intersection(x, y, z)

    # Empty branch elimination:

    Example:
        Intersection(x) => x