def _labels_post(request, instance):
    form = TagForm(request.data)

    if form.is_valid():
        tags = form.cleaned_data.get('tags', None)

        if tags:
            for tag in tags:
                instance.tags.add(tag)

            if isinstance(instance, XForm):
                xform_tags_add.send(sender=XForm, xform=instance, tags=tags)

            return status.HTTP_201_CREATED
Add a label to an instance.
dataset/ETHPy150Open kobotoolbox/kobocat/onadata/libs/mixins/labels_mixin.py/_labels_post