<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_callbacks(self, callback, errback=None, callback_args=None, callback_kwargs=None, errback_args=None, errback_kwargs=None):
 """Add a callback and errback to the callback chain. If the previous callback succeeds the return value is passed as the first argument to the next callback in the chain. If the previous callback raises an exception the exception is passed as the first argument to the next errback in the chain. """

        self._callbacks.appendleft((callback, errback, callback_args,
                               callback_kwargs, errback_args,
                               errback_kwargs))

        if self.called:
            self._do_callbacks()

        return self