<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add(app: web.Application, feature: Any, key: Hashable = None, exist_ok: bool = False ):
 """ Adds a new feature to the app. Features can either be registered as the default feature for the class, or be given an explicit name. Args: app (web.Application):
 The current Aiohttp application. feature (Any):
 The new feature that should be registered. It is recommended, but not required to use a `ServiceFeature`. key (Hashable, optional):
 The key under which the feature should be registered. Defaults to `type(feature)`. exist_ok (bool):
 If truthy, this function will do nothing if a feature was already registered for `key`. Otherwise, an exception is raised. """

    if FEATURES_KEY not in app:
        app[FEATURES_KEY] = dict()

    key = key or type(feature)

    if key in app[FEATURES_KEY]:
        if exist_ok:
            return
        else:
            raise KeyError(f'Feature "{key}" already registered')

    app[FEATURES_KEY][key] = feature