code: def _mass_PI(
      Q,
      T,
      M_T,
      Σ_T,
      trivial_idx=None,
      excl_zone=0,
      left=False,
      right=False,
      T_subseq_isconstant=None,
      Q_subseq_isconstant=None,
  ):
      """
      Compute "Mueen's Algorithm for Similarity Search" (MASS)
  
      Parameters
      ----------
      Q : numpy.ndarray
          Query array or subsequence
  
      T : numpy.ndarray
          Time series array or sequence
  
      M_T : numpy.ndarray
          Sliding mean for `T`
  
      Σ_T : numpy.ndarray
          Sliding standard deviation for `T`
  
      T_subseq_isconstant : numpy.ndarray
          A boolean array that indicates whether a subsequence in `T` is constant (True)
  
      trivial_idx : int, default None
          Index for the start of the trivial self-join
  
      excl_zone : int, default 0
          The half width for the exclusion zone relative to the `trivial_idx`.
          If the `trivial_idx` is `None` then this parameter is ignored.
  
      left : bool, default False
          Return the left matrix profile indices if `True`. If `right` is True
          then this parameter is ignored.
  
      right : bool, default False
          Return the right matrix profiles indices if `True`
  
      T_subseq_isconstant : numpy.ndarray or function, default None
          A boolean array that indicates whether a subsequence in `T` is constant
          (True). Alternatively, a custom, user-defined function that returns a
          boolean array that indicates whether a subsequence in `T` is constant
          (True). The function must only take two arguments, `a`, a 1-D array,
          and `w`, the window size, while additional arguments may be specified
          by currying the user-defined function using `functools.partial`. Any
          subsequence with at least one np.nan/np.inf will automatically have its
          corresponding value set to False in this boolean array.
  
      Q_subseq_isconstant : numpy.ndarray or function, default None
          A boolean array that indicates whether the subsequence in `Q` is constant
          (True). Alternatively, a custom, user-defined function that returns a
          boolean array that indicates whether a subsequence in `Q` is constant
          (True). The function must only take two arguments, `a`, a 1-D array,
          and `w`, the window size, while additional arguments may be specified
          by currying the user-defined function using `functools.partial`. Any
          subsequence with at least one np.nan/np.inf will automatically have its
          corresponding value set to False in this boolean array.
  
      Returns
      -------
      P : numpy.ndarray
          Matrix profile
  
      I : numpy.ndarray
          Matrix profile indices
      """
      D = core.mass(
          Q,
          T,
          M_T,
          Σ_T,
          T_subseq_isconstant=T_subseq_isconstant,
          Q_subseq_isconstant=Q_subseq_isconstant,
      )
  
      if trivial_idx is not None:
          core.apply_exclusion_zone(D, trivial_idx, excl_zone, np.inf)
  
          # Get left and right matrix profiles
          IL = -1
          PL = np.inf
          if D[:trivial_idx].size:
              IL = np.argmin(D[:trivial_idx])
              PL = D[IL]
          if PL == np.inf:
              IL = -1
  
          IR = -1
          PR = np.inf
          if D[trivial_idx + 1 :].size:
              IR = trivial_idx + 1 + np.argmin(D[trivial_idx + 1 :])
              PR = D[IR]
          if PR == np.inf:
              IR = -1
  
      # Element-wise Min
      I = np.argmin(D)
      P = D[I]
      if P == np.inf:
          I = -1
  
      if trivial_idx is not None and left:
          I = IL
          P = PL
  
      if trivial_idx is not None and right:
          I = IR
          P = PR
  
      return P, I
  
imports: import numpy
  from .None import core
label_desc: Use image node_id 1 for calling a global function with example usage: _mass_PI(Q, T, M_T, Σ_T, trivial_idx, excl_zone, left, right, T_subseq_isconstant, Q_subseq_isconstant) and returns: P,  I