'Return the revision content parsed and cleaned by tidy.
First, check in denormalized db field. If it\'s not available, schedule
an asynchronous task to store it.
allow_none -- To prevent CPU-hogging calls, return None instead of
calling tidy_content in-process.'

def get_tidied_content(self, allow_none=False):

    if self.tidied_content:
        tidied_content = self.tidied_content
    elif allow_none:
        if (self.pk and (not settings.MAINTENANCE_MODE)):
            from .tasks import tidy_revision_content
            tidy_revision_content.delay(self.pk, refresh=False)
        tidied_content = None
    else:
        (tidied_content, errors) = tidy_content(self.content)
        if (self.pk and (not settings.MAINTENANCE_MODE)):
            Revision.objects.filter(pk=self.pk).update(tidied_content=tidied_content)
    self.tidied_content = (tidied_content or '')
    return tidied_content
