<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dumps(data, escape=False, **kwargs):
 """A wrapper around `json.dumps` that can handle objects that json module is not aware. This function is aware of a list of custom serializers that can be registered by the API user, making it possible to convert any kind of object to types that the json library can handle. """

    if 'sort_keys' not in kwargs:
        kwargs['sort_keys'] = True

    converted = json.dumps(data, default=_converter, **kwargs)
    if escape:
        # We're escaping the whole dumped string here cause there's no (easy)
        # way to hook into the native json library and change how they process
        # values like strings, None objects and some other "literal" stuff.
        #
        # Also, we're not escaping quotes here cause they're escaped by the
        # native json library already. So, we just escape basic html entities,
        # like <, > and &;
        return cgi.escape(converted)
    return converted