def load_content(self):
        """
        It's the main method of the class.
        Try to load the template from cache, get the versions and decode the
        content.
        If something was wrong during this process (or if we had a
        `__regenerate__` value to True in the context), create new content and
        save it in cache.
        """

        self.content = None

        if not self.regenerate:
            try:
                self.content = self.cache_get()
            except Exception:
                if is_template_debug_activated():
                    raise
                logger.exception('Error when getting the cached template fragment')

        try:

            assert self.content

            self.split_content_version()

            assert self.content

            if self.content_internal_version != self.INTERNAL_VERSION or (
                    self.options.versioning and self.content_version != self.version):
                self.content = None

            assert self.content

            if self.options.compress:
                self.decode_content()

        except Exception:
            self.create_content()

        self.content = smart_str(self.content)