def METHOD_NAME(self, origin):
    if not origin.use_s3_theme:
        try:
            with open(origin.name) as fp:
                return fp.read()
        # Python 3 only
        #except FileNotFoundError:
        #    raise TemplateDoesNotExist(origin)
        # Python 2 and 3
        except IOError as e:
            if e.errno == errno.ENOENT:
                raise TemplateDoesNotExist(origin)
            raise
    else:
        cache_key = ".".join([settings.SITE_CACHE_KEY, "theme", origin.name])
        cached_template = cache.get(cache_key)
        if cached_template == "tried":
            raise TemplateDoesNotExist(origin)
        if cached_template:
            return cached_template
        try:
            template = read_theme_file_from_s3(origin.name)
        except:
            # Cache that we tried this file
            cache.set(cache_key, "tried")
            raise TemplateDoesNotExist(origin)
        cache.set(cache_key, template)
        cache_group_key = "%s.theme_files_cache_list" % settings.SITE_CACHE_KEY
        cache_group_list = cache.get(cache_group_key)
        if cache_group_list is None:
            cache.set(cache_group_key, [cache_key])
        else:
            cache_group_list += [cache_key]
            cache.set(cache_group_key, cache_group_list)
        return template