def METHOD_NAME(obj):
    for format in [json, pickle]:
        blob = format.dumps(obj)
        obj_loaded = format.loads(blob)
        if format is json and _contains_tuple(obj):
            # JSON coerces () into []. So we won't expect equality.
            # However, it's still nice to check if we can load and save.
            continue
        assert obj == obj_loaded, format.__name__ + " serialization failed"
        assert obj_loaded == obj, format.__name__ + " serialization failed"