<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def render_to(filepath, context=None, output=None, at_encoding=anytemplate.compat.ENCODING, **options):
 """ Render given template file and write the result string to given `output`. The result string will be printed to sys.stdout if output is None or '-'. :param filepath: Template file path :param context: A dict or dict-like object to instantiate given template file :param output: File path to write the rendered result string to or None/'-' to print it to stdout :param at_encoding: Template encoding :param options: Optional keyword arguments such as: - at_paths: Template search paths - at_engine: Specify the name of template engine to use explicitly or None to find it automatically anyhow. - at_cls_args: Arguments passed to instantiate template engine class - other keyword arguments passed to the template engine to render templates with specific features enabled. """

    res = render(filepath, context=context, **options)
    anytemplate.utils.write_to_output(res, output, at_encoding)