More cleanup, remove explicit use of get_local_namespace, not caring about the explicitly set namespace
Use functools.partial instead of a lambda function to keep the object pickable.