code: def tozarr(path, x, group=None, dataset=None, **zarr_options):
      import zarr
  
      if isinstance(path, zarr.Array):
          arr = path
          if isinstance(arr.store, FSMap):
              root = arr.store.root
              path, dataset = root.rsplit("/", 1)
          else:
              path = arr.store.path
              if "/" in arr.path and group is None:
                  group = arr.path.rsplit("/", 1)[0]
              dataset = arr.basename
              if not dataset:
                  path, dataset = path.rsplit("/", 1)
          for attr in ["compressor", "filters"]:
              if getattr(arr, attr):
                  zarr_options[attr] = getattr(arr, attr)
      elif isinstance(path, str):
          if dataset is None:
              path, dataset = path.rsplit("/", 1)
      else:
          raise TypeError(
              "`path` passed has wrong type, "
              "expect str, or zarr.Array"
              f"got {type(path)}"
          )
  
      op = TensorToZarrDataStore(
          path=path,
          group=group,
          dataset=dataset,
          zarr_options=ZarrOptions(zarr_options),
      )
      return op(x)
  
imports: import pickle
  from typing import Dict
  import numpy
  from ...None import opcodes
  from ...serialization.serializables import FieldTypes, KeyField, StringField, BytesField, TupleField
  from ...lib.filesystem import get_fs, FSMap
  from ...utils import has_unknown_shape
  from .core import TensorDataStore
label_desc: Use image node_id 1 for calling a global function with example usage: tozarr(path, x, group, dataset) and returns: op