[XLA:Python] Add a C++ implementation of flatten_one_level.
[XLA:Python] Add a C++ implementation of flatten_one_level.

Also add a copy of the default registry that doesn't have None registered as a leaf, which is slightly faster than using an is_leaf function.

This is mostly just doing an old TODO.
