<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def save(d, output_file, indent=4, spacer=" ", quote='"', newlinechar="\n", end_comment=False, **kwargs):
 """ Write a dictionary to an output Mapfile on disk Parameters d: dict A Python dictionary based on the the mappyfile schema output_file: string The output filename indent: int The number of ``spacer`` characters to indent structures in the Mapfile spacer: string The character to use for indenting structures in the Mapfile. Typically spaces or tab characters (``\\t``) quote: string The quote character to use in the Mapfile (double or single quotes) newlinechar: string The character used to insert newlines in the Mapfile end_comment: bool Add a comment with the block type at each closing END statement e.g. END # MAP Returns ------- string The output_file passed into the function Example ------- To open a Mapfile from a string, and then save it to a file:: s = '''MAP NAME "TEST" END''' d = mappyfile.loads(s) fn = "C:/Data/mymap.map" mappyfile.save(d, fn) """

    map_string = _pprint(d, indent, spacer, quote, newlinechar, end_comment)
    _save(output_file, map_string)
    return output_file