code: def _parse_canonical_dbref(doc):
      
      for key in doc:
          if key.startswith('$') and key not in _DBREF_KEYS:
              # Other keys start with $, so dct cannot be parsed as a DBRef.
              return doc
      return DBRef(doc.pop('$ref'), doc.pop('$id'),
                   database=doc.pop('$db', None), **doc)
docs: Decode a JSON DBRef to bson.dbref.DBRef.