code: def _mask_to_limits(a, limits, inclusive):
      """Mask an array for values outside of given limits.
  
      This is primarily a utility function.
  
      Parameters
      ----------
      a : array
      limits : (float or None, float or None)
      A tuple consisting of the (lower limit, upper limit).  Values in the
      input array less than the lower limit or greater than the upper limit
      will be masked out. None implies no limit.
      inclusive : (bool, bool)
      A tuple consisting of the (lower flag, upper flag).  These flags
      determine whether values exactly equal to lower or upper are allowed.
  
      Returns
      -------
      A MaskedArray.
  
      Raises
      ------
      A ValueError if there are no values within the given limits.
      """
      lower_limit, upper_limit = limits
      lower_include, upper_include = inclusive
      am = ma.MaskedArray(a)
      if lower_limit is not None:
          if lower_include:
              am = ma.masked_less(am, lower_limit)
          else:
              am = ma.masked_less_equal(am, lower_limit)
  
      if upper_limit is not None:
          if upper_include:
              am = ma.masked_greater(am, upper_limit)
          else:
              am = ma.masked_greater_equal(am, upper_limit)
  
      if am.count() == 0:
          raise ValueError("No array values within given limits")
  
      return am
  
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 35 for calling a global function with example usage: _mask_to_limits(a, limits, inclusive) and returns: am