code: def feather_transformer(data, data_dir="_vegafusion_data"):
      from vegafusion import runtime
  
      if "vegafusion" not in alt.renderers.active:
          # Use default transformer if a vegafusion renderer is not active
          return alt.default_data_transformer(data)
      elif has_geo_interface(data):
          # Use default transformer for geo interface objects
          # (e.g. a geopandas GeoDataFrame)
          return alt.default_data_transformer(data)
      elif is_dataframe_like(data):
          if runtime.using_grpc:
              raise ValueError(
                  "DataFrame data sources are not yet supported by the gRPC runtime"
              )
  
          bytes_buffer = io.BytesIO()
          to_feather(data, bytes_buffer)
          file_bytes = bytes_buffer.getvalue()
  
          # Hash bytes to generate unique file name
          hasher = sha1()
          hasher.update(file_bytes)
          hashstr = hasher.hexdigest()
          fname = f"vegafusion-{hashstr}.feather"
  
          # Check if file already exists
          tmp_dir = pathlib.Path(data_dir) / "tmp"
          os.makedirs(tmp_dir, exist_ok=True)
          path = pathlib.Path(data_dir) / fname
          if not path.is_file():
              # Write to temporary file then move (os.replace) to final destination. This is more resistant
              # to race conditions
              with NamedTemporaryFile(
                  dir=tmp_dir, delete=False
              ) as tmp_file:
                  tmp_file.write(file_bytes)
                  tmp_name = tmp_file.name
  
              os.replace(tmp_name, path)
  
          return {"url": path.as_posix()}
      else:
          # Use default transformer if we don't recognize data
          return alt.default_data_transformer(data)
  
imports: import io
  import os
  import pathlib
  from hashlib import sha1
  from tempfile import NamedTemporaryFile
  import uuid
  import altair
  import pandas
  import pyarrow
  from weakref import WeakValueDictionary
label_desc: Use image node_id 5 for calling a global function with example usage: feather_transformer(data, data_dir) and returns: alt, alt, dict, alt