<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_output(self, out_name, type_or_serialize=None, **kwargs):
 """ Declare an output """

        if out_name not in self.engine.all_outputs():
            raise ValueError("'%s' is not generated by the engine %s" % (out_name, self.engine.all_outputs()))
        if type_or_serialize is None:
            type_or_serialize = GenericType()
        if not isinstance(type_or_serialize, GenericType) and callable(type_or_serialize):
            type_or_serialize = GenericType(serialize=type_or_serialize)
        elif not isinstance(type_or_serialize, GenericType):
            raise ValueError("the given 'type_or_serialize' is invalid")
        # register outpurs
        self._outputs[out_name] = {
            'serializer': type_or_serialize,
            'parameters': kwargs if kwargs else {}
        }