def group_pre_delete(instance, sender, **kwargs):
 if (instance.name == 'anonymous'):
  raise Exception('Deletion of the anonymous group is         not permitted as will break the geonode permissions system')

def group_pre_delete ( instance , sender , ** kwargs ) : if ( instance . name == 'anonymous' ) : raise Exception ( 'Deletion of the anonymous group is         not permitted as will break the geonode permissions system' )
make sure that the anonymous group is not deleted .