Use the factory to establish a connection to uri.

def connect(uri, factory=pymongo.MongoClient):
    """
    Use the factory to establish a connection to uri.
    """
    warnings.warn(
        "do not use. Just call MongoClient directly.", DeprecationWarning)
    return factory(uri)