def dump(obj, fp, **kwargs):
try:<EOL><INDENT>json.dump(obj, fp, **kwargs)<EOL><DEDENT>except Exception as e:<EOL><INDENT>raise JSONLibraryException(e)<EOL><DEDENT>
Serialize `obj` as a JSON formatted stream to `fp` (a
    `.write()`-supporting file-like object). Accepts the same arguments as
    `json` module in stdlib.

    :param obj: a JSON serializable Python object.
    :param fp: a `.read()`-supporting file-like object containing a JSON
               document with or without comments.
    :param kwargs: all the arguments that `json.dump <http://docs.python.org/
                   2/library/json.html#json.dump>`_ accepts.
    :raises: commentjson.JSONLibraryException