def check_connection(host='<STR_LIT:localhost>', port=<NUM_LIT>, username=None, password=None,<EOL>authdb=None, max_delay=<NUM_LIT:1>):
<EOL>if username and password:<EOL><INDENT>uri = ("<STR_LIT>"<EOL>.format(quote_plus(username), quote_plus(password), host, port, authdb))<EOL>log_uri = ("<STR_LIT>"<EOL>.format(quote_plus(username), host, port, authdb))<EOL><DEDENT>else:<EOL><INDENT>log_uri = uri = "<STR_LIT>" % (host, port)<EOL><DEDENT>LOG.info("<STR_LIT>", log_uri)<EOL>client = MongoClient(uri, serverSelectionTimeoutMS=max_delay)<EOL>try:<EOL><INDENT>client.server_info()<EOL><DEDENT>except (ServerSelectionTimeoutError,OperationFailure) as err:<EOL><INDENT>LOG.warning(err)<EOL>return False<EOL><DEDENT>return True<EOL>
Check if a connection could be made to the mongo process specified

    Args:
        host(str)
        port(int)
        username(str)
        password(str)
        authdb (str): database to to for authentication
        max_delay(int): Number of milliseconds to wait for connection

    Returns:
        bool: If connection could be established