python: move Query class to its own file