def db_setup(ensure_indexes=True):
    """
    Creates the database and indexes (optional).
    """
    db_cfg = db_config()
    db_cfg["ensure_indexes"] = ensure_indexes
    connection = db_init.db_setup_with_retry(**db_cfg)
    return connection

    Creates the database and indexes (optional).
    
st2common/st2common/database_setup.py