code: def jsonify(symbol):
      
      try:
          # all symbols have a toJson method, try it
          return json.dumps(symbol.toJson(), indent='  ')
      except AttributeError:
          pass
      return json.dumps(symbol, indent='  ')
docs: returns json format for symbol