def __init__(self, uri, **config):
		self.uri = uri
		prefix = config.pop('prefix', '')
		
		log.info("Connecting MongoEngine to '%s'.", _safe_uri_replace.sub(r'\1://\2@', uri))
		
		connection = self.connection = dict(tz_aware=True)
		
		scheme, parts = uri.split('://', 1)
		parts, self.db = parts.split('/', 1)
		auth, host = parts.split('@', 1) if parts in '@' else (None, parts)
		
		if scheme != 'mongodb':
			raise Exception('The URL must begin with \'mongodb://\'!')
		
		connection['host'], connection['port'] = host.split(':') if ':' in host else (host, '27017')
		connection['port'] = int(connection['port'])
		
		if auth:  # pragma: no cover
			connection['username'], _, connection['password'] = auth.partition(':')
		
		# Accept additional keyword arguments to mongoengine.connect() from the INI.
		for k, v in items(config):
			pfx, _, k = k.rpartition('.')
			if pfx != prefix or k in ('engine', 'model', 'ready'): continue
			connection[k] = int(v) if v.isdigit() else v
		
		self.cb = config.get('ready', None)
dataset/ETHPy150Open marrow/contentment/web/ext/mongodb/mongoengine.py/MongoEngineExtension.__init__/swapped operands of `in`