def generate_identifier(sender, instance, **kwargs):
    """
    Generate and set identifier of concept before saving object to DB

    Args:
        sender (class): should be Concept
        instance (Concept): saving concept
    """
    identifier = Concept.create_identifier(instance.query)
    qs = Concept.objects.filter(identifier=identifier, lang=instance.lang)
    if instance.pk:
        qs = qs.exclude(pk=instance.pk)
    if qs.count() > 0:
        raise ValueError("Concept identifier conflict")
    instance.identifier = identifier
Generate and set identifier of concept before saving object to DB

    Args:
        sender (class): should be Concept
        instance (Concept): saving concept