def _do_import_tags(self, project_ids, collected_tags):
        tags_to_import_now = set([])
        tags_to_import_after = set([])
        for tag in collected_tags:
            if self._is_prefix_of_any_other_tag(tag, collected_tags):
                tags_to_import_after.add(tag)
            else:
                tags_to_import_now.add(tag)
        for project_id in project_ids:
            for (issue_id, tags) in self._get_issue_tags(project_id):
                yt_issue_id = u'%s-%s' % (project_id, issue_id)
                for tag in tags:
                    if tag in tags_to_import_now:
                        try:
                            self._target.executeCommand(yt_issue_id, u'tag ' + tag)
                        except YouTrackException:
                            print(u'Failed to import tag for issue [%s]' % yt_issue_id)
        if len(tags_to_import_after):
            self._do_import_tags(project_ids, tags_to_import_after)
dataset/ETHPy150Open JetBrains/youtrack-rest-python-library/python/youtrackImporter.py/YouTrackImporter._do_import_tags/original