'Render content using kumascript and any other services necessary.'

def render(self, cache_control=None, base_url=None, timeout=None):

    if settings.MAINTENANCE_MODE:
        return
    if (not base_url):
        base_url = settings.SITE_URL
    if self.is_rendering_in_progress:
        raise DocumentRenderingInProgress
    now = datetime.now()
    Document.objects.filter(pk=self.pk).update(render_started_at=now)
    self.render_started_at = now
    if (not config.KUMASCRIPT_TIMEOUT):
        (self.rendered_html, self.rendered_errors) = (self.html, [])
    else:
        (self.rendered_html, errors) = kumascript.get(self, cache_control, base_url, timeout=timeout)
        self.rendered_errors = ((errors and json.dumps(errors)) or None)
    self.regenerate_cache_with_fields()
    self.last_rendered_at = datetime.now()
    timeout = config.KUMA_DOCUMENT_FORCE_DEFERRED_TIMEOUT
    max_duration = timedelta(seconds=timeout)
    duration = (self.last_rendered_at - self.render_started_at)
    if (duration >= max_duration):
        self.defer_rendering = True
    if self.render_max_age:
        self.render_expires = (datetime.now() + timedelta(seconds=self.render_max_age))
    else:
        self.render_expires = None
    self.save()
    render_done.send(sender=self.__class__, instance=self)
