code: def outliers_iqr(
      x: Union[List, np.ndarray],
      ret: str = "filtered",
      coef: float = 1.5,
  ) -> np.ndarray:
      """Simple detection of potential outliers based on interquartile range
      (IQR). Data that lie within the lower and upper limits are considered
      non-outliers. The lower limit is the number that lies 1.5 IQRs below
      (coefficient may be changed with an argument, see Parameters)
      the first quartile; the upper limit is the number that lies 1.5 IQRs
      above the third quartile.
  
      Parameters
      ----------
      x : Union[List, np.ndarray]
          An array, any object exposing the array interface, containing
          p values.
  
      ret : str = 'filtered'
          Specifies object to be returned. Available options are:
  
          - ``filtered``: return a filtered array (default)
          - ``outliers``: return outliers
          - ``indices``: return indices of non-outliers
          - ``outliers_indices``: return indices of outliers
  
      coef : float = 1.5
          Coefficient by which IQR is multiplied.
  
      Returns
      -------
      numpy.ndarray
          One of the following objects:
  
          - Filtered array (default) if ``ret`` is set to ``filtered``.
          - Array with indices of elements lying within the specified limits
            if ``ret`` is set to ``indices``.
          - Array with outliers if ``ret`` is set to ``outliers``.
          - Array with indices of outlier elements
            if ``ret`` is set to ``outliers_indices``.
  
      Examples
      --------
      >>> x = np.array([4, 5, 6, 10, 12, 4, 3, 1, 2, 3, 23, 5, 3])
      >>> outliers_iqr(x, ret = 'outliers')
      array([12, 23])
      """
      arr = np.copy(x)
  
      q1, q3 = np.percentile(arr, [25, 75])
      iqr = q3 - q1
      ll = q1 - iqr * coef
      ul = q3 + iqr * coef
  
      if ret == "indices":
          return np.where((arr > ll) & (arr < ul))[0]
      elif ret == "outliers":
          return arr[(arr < ll) | (arr > ul)]
      elif ret == "outliers_indices":
          return np.where((arr < ll) | (arr > ul))[0]
      else:
          return x[(x > ll) & (x < ul)]
  
imports: from typing import Union, List
  import numpy
  from scipy.stats import t
label_desc: Use image node_id 1 for calling a global function with example usage: outliers_iqr(x, ret, coef) and returns: np, arr, np, x