code: def trim(x, axes=None):
      """Trim boundaries off of array
  
      >>> x = np.arange(24).reshape((4, 6))
      >>> trim(x, axes={0: 0, 1: 1})
      array([[ 1,  2,  3,  4],
             [ 7,  8,  9, 10],
             [13, 14, 15, 16],
             [19, 20, 21, 22]])
  
      >>> trim(x, axes={0: 1, 1: 1})
      array([[ 7,  8,  9, 10],
             [13, 14, 15, 16]])
      """
      if isinstance(axes, Integral):
          axes = [axes] * x.ndim
      if isinstance(axes, dict):
          axes = [axes.get(i, 0) for i in range(x.ndim)]
  
      return x[tuple(slice(ax, -ax if ax else None) for ax in axes)]
  
imports: from __future__ import annotations
  import contextlib
  from collections.abc import Container, Iterable, Sequence
  from functools import wraps
  from numbers import Integral
  import numpy
  from tlz import concat
  from dask.core import flatten
label_desc: Use image node_id 3 for calling a global function with example usage: trim(x, axes) and returns: x