"""Utility functions for checking feature flags.""" from lambdacommon.common_config import logger from pythonfeatures import pythonfeatures def is_feature_enabled(feature: str, account_id: int) -> bool: """Check if a feature is enabled for a given account. Args: feature (str): Feature to check account_id (int): ID of the account to check for Returns: bool: True if feature is enabled, False otherwise """ feature_response = pythonfeatures.get_single_feature_by_attributes( feature, {'vendor_id': account_id} ) if feature_response.status != 200: logger.warning(f'Unable to fetch feature: {feature_response.message}') return False logger.info(f'Feature check: {feature}=={feature_response.message}') return feature_response.message == 'enabled'