<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def on_chain_updated(self, chain_head, committed_batches=None, uncommitted_batches=None):
 """ The existing chain has been updated, the current head block has changed. :param chain_head: the new head of block_chain, can be None if no block publishing is desired. :param committed_batches: the set of batches that were committed as part of the new chain. :param uncommitted_batches: the list of transactions if any that are now de-committed when the new chain was selected. :return: None """

        try:
            self._py_call(
                'on_chain_updated',
                ctypes.py_object(chain_head),
                ctypes.py_object(committed_batches),
                ctypes.py_object(uncommitted_batches))

        # pylint: disable=broad-except
        except Exception:
            LOGGER.exception(
                "Unhandled exception in BlockPublisher.on_chain_updated")