<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def delete_renditions_if_master_has_changed(sender, instance, **kwargs):
    '''if master file as changed delete all renditions'''
    try:
        obj = sender.objects.get(pk=instance.pk)
    except sender.DoesNotExist:
        pass  # Object is new, so field hasn't technically changed.
    else:
        if not obj.master == instance.master:  # Field has changed
            obj.master.delete(save=False)
            instance.delete_all_renditions()