def dumps(data, use_yaml=None, safe=True, **kwds):
if use_yaml is None:<EOL><INDENT>use_yaml = ALWAYS_DUMP_YAML<EOL><DEDENT>if use_yaml:<EOL><INDENT>dumps = yaml.safe_dump if safe else yaml.dump<EOL><DEDENT>else:<EOL><INDENT>dumps = json.dumps<EOL>kwds.update(indent=<NUM_LIT:4>, sort_keys=True)<EOL>if not safe:<EOL><INDENT>kwds.update(default=repr)<EOL><DEDENT><DEDENT>return dumps(data, **kwds)<EOL>
Dumps data into a nicely formatted JSON string.

:param dict data: a dictionary to dump
:param kwds: keywords to pass to json.dumps
:returns: a string with formatted data
:rtype: str