code: def trima(a, limits=None, inclusive=(True, True)):
      """
      Trims an array by masking the data outside some given limits.
  
      Returns a masked version of the input array.
  
      Parameters
      ----------
      a : array_like
          Input array.
      limits : {None, tuple}, optional
          Tuple of (lower limit, upper limit) in absolute values.
          Values of the input array lower (greater) than the lower (upper) limit
          will be masked.  A limit is None indicates an open interval.
      inclusive : (bool, bool) tuple, optional
          Tuple of (lower flag, upper flag), indicating whether values exactly
          equal to the lower (upper) limit are allowed.
  
      """
      a = ma.asarray(a)
      a.unshare_mask()
      if (limits is None) or (limits == (None, None)):
          return a
  
      (lower_lim, upper_lim) = limits
      (lower_in, upper_in) = inclusive
      condition = False
      if lower_lim is not None:
          if lower_in:
              condition |= a < lower_lim
          else:
              condition |= a <= lower_lim
  
      if upper_lim is not None:
          if upper_in:
              condition |= a > upper_lim
          else:
              condition |= a >= upper_lim
  
      a[condition.filled(True)] = masked
      return a
  
imports: from __future__ import division, print_function, absolute_import
  import numpy
  from numpy import ndarray
  import numpy.ma
  from numpy.ma import masked, nomask
  from scipy._lib.six import iteritems
  import itertools
  import warnings
  from collections import namedtuple
  from .None import distributions
  import scipy.special
  from ._stats_mstats_common import _find_repeats, linregress, theilslopes, siegelslopes
label_desc: Use image node_id 26 for calling a global function with example usage: trima(a, limits, inclusive) and returns: a, a