code: def fromzarr(path, group=None, dataset=None, chunk_size=None):
      import zarr
  
      try:
          # since v2.11.0, zarr convert mutable mappings to KVStore
          from zarr.storage import KVStore as zarr_kvstore
      except ImportError:  # pragma: no cover
          zarr_kvstore = None
  
      if isinstance(path, zarr.Array):
          arr = path
          if zarr_kvstore is None and isinstance(
              arr.store, FSMap
          ):  # pragma: no cover
              root = arr.store.root
              path, dataset = root.rsplit("/", 1)
          elif zarr_kvstore and isinstance(arr.store, zarr_kvstore):
              root = arr.store._mutable_mapping.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)
          shape = arr.shape
      elif isinstance(path, str):
          fs = get_fs(path, None)
          fs_map = FSMap(path, fs)
  
          if group is None and dataset is None:
              arr = zarr.open(fs_map)
              if isinstance(arr, zarr.Array):
                  return fromzarr(arr, chunk_size=chunk_size)
  
          g = zarr.group(store=fs_map)
          arr = g[TensorFromZarr.get_path(group, dataset)]
          shape = arr.shape
      else:
          raise TypeError(
              "`path` passed has wrong type, "
              "expect str, or zarr.Array"
              f"got {type(path)}"
          )
  
      chunk_size = chunk_size if chunk_size is not None else arr.chunks
      op = TensorFromZarr(
          filename=path, group=group, dataset=dataset, dtype=arr.dtype
      )
      return op(
          shape, chunk_size=chunk_size, order=TensorOrder(arr.order)
      )
  
file_path: mars/mars/tensor/datasource/from_zarr.py
imports: from ...None import opcodes
  from ...lib.filesystem import get_fs, FSMap
  from ..core import TensorOrder
  from .core import TensorFromHDF5Like
label_desc: Use image node_id 1 for calling a global function with example usage: fromzarr(path, group, dataset, chunk_size) and returns: op, fromzarr