Prepare and dispatch a trait change event to a listener.

def _dispatch_change_event(self, object, trait_name, old, new, handler):
    """ Prepare and dispatch a trait change event to a listener. """

    # Extract the arguments needed from the handler.
    args = self.argument_transform(object, trait_name, old, new)

    # Send a description of the event to the change event tracer.
    if tnotifier._pre_change_event_tracer is not None:
        tnotifier._pre_change_event_tracer(object, trait_name, old, new, handler)

    # Dispatch the event to the listener.
    from automate.common import SystemNotReady
    try:
        self.dispatch(handler, *args)
    except SystemNotReady:
        pass
    except Exception as e:
        if tnotifier._post_change_event_tracer is not None:
            tnotifier._post_change_event_tracer(object, trait_name, old, new,
                                                handler, exception=e)
        # This call needs to be made inside the `except` block in case
        # the handler wants to re-raise the exception.
        tnotifier.handle_exception(object, trait_name, old, new)
    else:
        if tnotifier._post_change_event_tracer is not None:
            tnotifier._post_change_event_tracer(object, trait_name, old, new,
                                                handler, exception=None)