<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def export_to_template(filename, args, exclude=None):
 """Exports given options to the given filename in INI format. :param filename: Filename to save options to :param dict args: Arguments to export :param list exclude (optional):
 Exclusion list for options that should not be exported """

    exclude = exclude or []
    exclude.append('config')
    exclude.append('really')
    exclude.append('format')
    exclude.append('debug')

    with open(filename, "w") as template_file:
        for k, val in args.items():
            if val and k not in exclude:
                if isinstance(val, tuple):
                    val = ','.join(val)
                if isinstance(val, list):
                    val = ','.join(val)
                template_file.write('%s=%s\n' % (k, val))