<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_json(value, pretty=False):
 """ Serializes the given value to JSON. :param value: the value to serialize :param pretty: whether or not to format the output in a more human-readable way; if not specified, defaults to ``False`` :type pretty: bool :rtype: str """


    options = {
        'sort_keys': False,
        'cls': BasicJSONEncoder,
    }
    if pretty:
        options['indent'] = 2
        options['separators'] = (',', ': ')

    return json.dumps(value, **options)