def METHOD_NAME(sender, instance, using, **kwargs):
    """Check for layer dependencies before delete and raises if any"""
    from qdjango.models import Layer
    dependent_layers = [l.name for l in  Layer.objects.filter(datasource__contains=instance.id)]
    if len(dependent_layers) > 0:
        raise LayerDependenciesError(_("QGIS Auth %s cannot be deleted because it is used by the following layers: %s" % (instance.id, ', '.join(dependent_layers))))