# Buggy code
def add_arguments(self, parser):
    parser.add_argument(
        "--interval",
        action="store",
        dest="interval",
        help="Number of minutes to wait after a successful ping before the next ping.",
    )
    parser.add_argument(
        "--checkrate",
        action="store",
        dest="checkrate",
        help="Number of minutes to wait between failed ping attempts.",
    )
    parser.add_argument(
        "--server",
        action="store",
        dest="server",
        help="Base URL of the server to connect to.",
    )


# Traceback (TypeError)
INFO:kolibri.core.analytics.management.commands.ping:Ping succeeded! (response: {'id': 87135})
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/Users/d/Projects/learning_equality/repos/k011x/kolibri/utils/server.py", line 109, in run
call_command("ping")
File "/Users/d/Projects/learning_equality/repos/k011x/.venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 131, in call_command
return command.execute(*args, **defaults)
File "/Users/d/Projects/learning_equality/repos/k011x/.venv/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/Users/d/Projects/learning_equality/repos/k011x/kolibri/core/analytics/management/commands/ping.py", line 58, in handle
self.perform_statistics(server, data["id"])
File "/Users/d/Projects/learning_equality/repos/k011x/kolibri/core/analytics/management/commands/ping.py", line 123, in perform_statistics
jsondata = dump_zipped_json(data)
File "/Users/d/Projects/learning_equality/repos/k011x/kolibri/core/analytics/utils.py", line 37, in dump_zipped_json
jsondata = json.dumps(data)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/encoder.py", line 180, in default
o.__class__.__name__)
TypeError: Object of type 'bytes' is not JSON serializable

# Fixed code
def add_arguments(self, parser):
    parser.add_argument(
        "--interval",
        action="store",
        dest="interval",
        help="Number of minutes to wait after a successful ping before the next ping.",
    )
    parser.add_argument(
        "--checkrate",
        action="store",
        dest="checkrate",
        help="Number of minutes to wait between failed ping attempts.",
    )
    parser.add_argument(
        "--server",
        action="store",
        dest="server",
        help="Base URL of the server to connect to.",
    )
    parser.add_argument(
        "--once",
        action="store_true",
        dest="once",
        help="Only try to ping once, then exit",
    )