def METHOD_NAME(x):
    """Encode a value that JSON does not support natively"""
    for serializer in string_serializers:
        if isinstance(x, serializer.type):
            return {"$type": serializer.name, "$value": serializer.to_json(x)}
    raise TypeError(type(x))  # pragma: no cover