@exporter('<STR_LIT>', ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'))<EOL>def save_json(filename, obj, normalize=True):
from neuropythy.util import normalize as norm<EOL>dat = norm(obj) if normalize else obj<EOL>if pimms.is_str(filename):<EOL><INDENT>if any(filename.endswith(s) for s in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>')):<EOL><INDENT>with gzip.open(filename, '<STR_LIT>') as fl: json.dump(dat, fl)<EOL><DEDENT>else:<EOL><INDENT>with open(filename, '<STR_LIT>') as fl: json.dump(dat, fl)<EOL><DEDENT><DEDENT>else: json.dump(dat, filename)<EOL>return filename<EOL>
save_json(filename, obj) writes the given object to the given filename (or stream) in a
  normalized JSON format.

The optional argument normalize (default True) may be set to False to prevent the object from
being run through neuropythy's normalize system.