code: def to_json(value, pretty=False):
      
  
      options = {
          'sort_keys': False,
          'cls': BasicJSONEncoder,
      }
      if pretty:
          options['indent'] = 2
          options['separators'] = (',', ': ')
  
      return json.dumps(value, **options)
docs: 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