docs: def _parse_canonical_symbol(doc):
      """Decode a JSON symbol to Python string."""
      symbol = doc['$symbol']
      if len(doc) != 1:
          raise TypeError('Bad $symbol, extra field(s): %s' % (doc,))
      return text_type(symbol)