"""Feature flag.""" from pythonfeatures.pythonfeatures import get_single_feature_by_attributes from src import config from src import constants def is_eligible_for_auto_approval(complete_product): """Check if product is eligible for auto approval.""" label_info = complete_product.get('label') if not label_info: return False vendor_id = label_info.get('vendor_id') subaccount_id = label_info.get('subaccount_id') if not vendor_id: return False attributes = {'vendor_id': str(vendor_id)} if subaccount_id: attributes['subaccount_id'] = str(subaccount_id) result = get_single_feature_by_attributes(config.AUTO_APPROVAL_FF_NAME, attributes) return result.message == constants.ENABLED