code: def einsum(
      *operands, dtype=None, optimize=False, split_every=None, **kwargs
  ):
      """Dask added an additional keyword-only argument ``split_every``.
  
      split_every: int >= 2 or dict(axis: int), optional
          Determines the depth of the recursive aggregation.
          Deafults to ``None`` which would let dask heuristically
          decide a good default.
      """
  
      einsum_dtype = dtype
  
      inputs, outputs, ops = parse_einsum_input(operands)
      subscripts = "->".join((inputs, outputs))
  
      # Infer the output dtype from operands
      if dtype is None:
          dtype = np.result_type(*[o.dtype for o in ops])
  
      if optimize is not False:
          # Avoid computation of dask arrays within np.einsum_path
          # by passing in small numpy arrays broadcasted
          # up to the right shape
          fake_ops = [
              np.broadcast_to(o.dtype.type(0), shape=o.shape)
              for o in ops
          ]
          optimize, _ = np.einsum_path(
              subscripts, *fake_ops, optimize=optimize
          )
  
      inputs = [tuple(i) for i in inputs.split(",")]
  
      # Set of all indices
      all_inds = {a for i in inputs for a in i}
  
      # Which indices are contracted?
      contract_inds = all_inds - set(outputs)
      ncontract_inds = len(contract_inds)
  
      # Introduce the contracted indices into the blockwise product
      # so that we get numpy arrays, not lists
      result = blockwise(
          chunk_einsum,
          tuple(outputs) + tuple(contract_inds),
          *(a for ap in zip(ops, inputs) for a in ap),
          # blockwise parameters
          adjust_chunks={ind: 1 for ind in contract_inds},
          dtype=dtype,
          # np.einsum parameters
          subscripts=subscripts,
          kernel_dtype=einsum_dtype,
          ncontract_inds=ncontract_inds,
          optimize=optimize,
          **kwargs,
      )
  
      # Now reduce over any extra contraction dimensions
      if ncontract_inds > 0:
          size = len(outputs)
          return result.sum(
              axis=list(range(size, size + ncontract_inds)),
              split_every=split_every,
          )
  
      return result
  
imports: from __future__ import annotations
  import numpy
  from dask.array.core import asarray, blockwise, einsum_lookup
  from dask.utils import derived_from
label_desc: Use image node_id 3 for calling a global function with example usage: einsum() and returns: result, result