from pydantic import UUID1, UUID4 from product_staging.connectors import ows_account async def check_feature_control_for_vendor_uuid( vendor_uuid: UUID1 | UUID4 | None, feature_control: str ): """Check whether feature control enabled for vendor. Args: vendor_uuid (UUID1 | UUID4): unique identifier of the vendor. feature_control (string): type of feature control Returns: response: True or False """ if not vendor_uuid: return False vendor_id = await ows_account.get_vendor_id(vendor_uuid) return await check_feature_control_for_vendor_id(vendor_id, feature_control) async def check_feature_control_for_vendor_id( vendor_id: int | None, feature_control: str ): """Check whether feature control enabled for vendor. Args: vendor_id (int): unique identifier of the vendor. feature_control (string): type of feature control Returns: response: True or False """ if not vendor_id: return False features_control = await ows_account.get_enabled_vendor_features_control(vendor_id) return any( feature_obj.get("feature_name") == feature_control for feature_obj in features_control )