def _parse_legacy_uuid(doc):
    """Decode a JSON legacy $uuid to Python UUID."""
    if len(doc) != 1:
        raise TypeError('Bad $uuid, extra field(s): %s' % (doc,))
    return uuid.UUID(doc["$uuid"])
Decode a JSON legacy $uuid to Python UUID.
stackoverflow/venv/lib/python3.6/site-packages/bson/json_util.py