<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def tracking_save(sender, instance, raw, using, update_fields, **kwargs):
 """ Post save, detect creation or changes and log them. We need post_save to have the object for a create. """

    if _has_changed(instance):
        if instance._original_fields['pk'] is None:
            # Create
            _create_create_tracking_event(instance)
        else:
            # Update
            _create_update_tracking_event(instance)
    if _has_changed_related(instance):
        # Because an object need to be saved before being related,
        # it can only be an update
        _create_update_tracking_related_event(instance)
    if _has_changed(instance) or _has_changed_related(instance):
        _set_original_fields(instance)