add python api to set flags