<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register_asset(self, type_, *assets):
 """Register webassets bundle to be served on all pages. :param type_: `"css"`, `"js-top"` or `"js""`. :param assets: a path to file, a :ref:`webassets.Bundle <webassets:bundles>` instance or a callable that returns a :ref:`webassets.Bundle <webassets:bundles>` instance. :raises KeyError: if `type_` is not supported. """

        supported = list(self._assets_bundles.keys())
        if type_ not in supported:
            msg = "Invalid type: {}. Valid types: {}".format(
                repr(type_), ", ".join(sorted(supported))
            )
            raise KeyError(msg)

        for asset in assets:
            if not isinstance(asset, Bundle) and callable(asset):
                asset = asset()

            self._assets_bundles[type_].setdefault("bundles", []).append(asset)