def METHOD_NAME(
    self, instance: typing.Union[FeatureState, FeatureStateModel]
) -> typing.Union[str, int, bool]:
    identity = self.context["identity"]
    environment_api_key = self.context["environment_api_key"]
    environment = Environment.get_from_cache(environment_api_key)
    hash_key = identity.get_hash_key(
        environment.use_identity_composite_key_for_hashing
    )
    if isinstance(instance, FeatureState):
        return instance.get_feature_state_value_by_hash_key(hash_key)
    return instance.get_value(hash_key)