Render given template file and return the result.

        :param template: Template file path
        :param context: A dict or dict-like object to instantiate given
            template file
        :param at_paths: Template search paths
        :param at_encoding: Template encoding
        :param kwargs: Keyword arguments passed to the template engine to
            render templates with specific features enabled.

        :return: Rendered string

def render_impl(self, template, context, at_paths=None,
                    at_encoding=anytemplate.compat.ENCODING, **kwargs):
        """
        Render given template file and return the result.

        :param template: Template file path
        :param context: A dict or dict-like object to instantiate given
            template file
        :param at_paths: Template search paths
        :param at_encoding: Template encoding
        :param kwargs: Keyword arguments passed to the template engine to
            render templates with specific features enabled.

        :return: Rendered string
        """
        if "text" in kwargs:
            kwargs["text"] = None

        if "input_encoding" not in kwargs:
            kwargs["input_encoding"] = at_encoding.lower()

        if "output_encoding" not in kwargs:
            kwargs["output_encoding"] = at_encoding.lower()

        if at_paths is not None:
            paths = at_paths + self.lookup_options.get("directories", [])
            self.lookup_options["directories"] = paths

            lookup = mako.lookup.TemplateLookup(**self.lookup_options)
            kwargs["lookup"] = lookup

            template = anytemplate.utils.find_template_from_path(template,
                                                                 paths)
        # else:
        #     template = anytemplate.utils.find_template_from_path(template)

        kwargs["filename"] = template

        tmpl = mako.template.Template(**kwargs)
        return _render(tmpl, context)