<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_external_nodes(sender, **kwargs):
 """ sync by deleting nodes from external layers when needed """

    node = kwargs['instance']

    if node.layer.is_external is False or not hasattr(node.layer, 'external') or node.layer.external.synchronizer_path is None:
        return False

    if hasattr(node, 'external') and node.external.external_id:
        push_changes_to_external_layers.delay(
            node=node.external.external_id,
            external_layer=node.layer.external,
            operation='delete'
        )