Refactor MongoConnector for easier testing.
Use six for single-source compat.