<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def view(model: "Model", *functions: Callable) -> Optional[Callable]: """A decorator for registering a callback to a model Parameters: model: the model object whose changes the callback should respond to. Examples: .. code-block:: python from spectate import mvc items = mvc.List() @mvc.view(items) def printer(items, events):
 for e in events: print(e) items.append(1) """

    if not isinstance(model, Model):
        raise TypeError("Expected a Model, not %r." % model)

    def setup(function: Callable):
        model._model_views.append(function)
        return function

    if functions:
        for f in functions:
            setup(f)
    else:
        return setup