'This normalizes topic breadcrumb paths between locales.
Attempt to acquire a topic parent from a translation of our translation
parent\'s topic parent, auto-creating a stub document if necessary.'

def acquire_translated_topic_parent(self):

    if (not self.parent):
        return
    parent_topic = self.parent.parent_topic
    if (not parent_topic):
        return
    try:
        new_parent = parent_topic.translations.get(locale=self.locale)
    except Document.DoesNotExist:
        try:
            new_parent = Document.objects.get(locale=self.locale, slug=parent_topic.slug)
            if (not new_parent.parent):
                new_parent.parent = parent_topic
                new_parent.save()
        except Document.DoesNotExist:
            new_parent = Document.objects.get(pk=parent_topic.pk)
            new_parent.pk = None
            new_parent.current_revision = None
            new_parent.parent_topic = None
            new_parent.parent = parent_topic
            new_parent.locale = self.locale
            new_parent.save()
            if parent_topic.current_revision:
                new_rev = Revision.objects.get(pk=parent_topic.current_revision.pk)
                new_rev.pk = None
                new_rev.document = new_parent
                stub_tags = '"TopicStub","NeedsTranslation"'
                stub_l10n_tags = ['inprogress']
                if new_rev.tags:
                    new_rev.tags = ('%s,%s' % (new_rev.tags, stub_tags))
                else:
                    new_rev.tags = stub_tags
                new_rev.save()
                new_rev.localization_tags.add(*stub_l10n_tags)
    self.parent_topic = new_parent
    self.save()
