code: def format(ctx, input_mapfile, output_mapfile, indent, spacer, quote, newlinechar, expand, comments):
      
  
      quote = codecs.decode(quote, 'unicode_escape')  # ensure \t is handled as a tab
      spacer = codecs.decode(spacer, 'unicode_escape')  # ensure \t is handled as a tab
      newlinechar = codecs.decode(newlinechar, 'unicode_escape')  # ensure \n is handled as a newline
  
      d = mappyfile.open(input_mapfile, expand_includes=expand, include_comments=comments, include_position=True)
      mappyfile.save(d, output_mapfile, indent=indent, spacer=spacer, quote=quote, newlinechar=newlinechar)
      sys.exit(0)
docs: Format a the input-mapfile and save as output-mapfile. Note output-mapfile will be
      overwritten if it already exists.
  
      Example of formatting a single Mapfile:
  
          mappyfile format C:/Temp/valid.map C:/Temp/valid_formatted.map
  
      Example of formatting a single Mapfile with single quotes and tabs for indentation:
  
          mappyfile format C:/Temp/valid.map C:/Temp/valid_formatted.map --quote=\\' --indent=1 --spacer=\t
  
      Example of formatting a single Mapfile without expanding includes, but including comments:
  
          mappyfile format C:/Temp/valid.map C:/Temp/valid_formatted.map --no-expand --comments