def METHOD_NAME(fig1, fig_type_spec, fig_type):
    fig1_json = json.dumps(fig1, **opts)
    fig1_loaded = pio.from_json(fig1_json, output_type=fig_type_spec)
    # Check return type
    assert isinstance(fig1_loaded, fig_type)
    # Check return json
    assert pio.to_json(fig1_loaded) == pio.to_json(fig1.to_dict())