code: def _quantile(a, q, axis=None):
      if isinstance(q, float):
          q = np.asarray(q)
      ret_dtype = a.dtype
      if q.ndim > 1:
          raise ValueError(
              "q argument must be a scalar or 1-dimensional!"
          )
      if axis is None:
          axis = 0
          a = a.flatten()
      elif axis != 0:
          a = np.moveaxis(a, axis, 0)
          axis = 0
  
      n = a.shape[axis]
      indices = q * (n - 1)
  
      a.sort(axis)
  
      indices_below = np.floor(indices).astype(np.int32)
      indices_upper = np.ceil(indices).astype(np.int32)
  
      weights = indices - indices_below.astype("float64")
  
      indices_below = np.clip(indices_below, 0, n - 1)
      indices_upper = np.clip(indices_upper, 0, n - 1)
      tensor_upper = np.take(
          a, indices_upper, axis=axis
      )  # , mode="clip")
      tensor_below = np.take(
          a, indices_below, axis=axis
      )  # , mode="clip")
  
      pred = weights <= 0.5
      out = np.where(pred, tensor_below, tensor_upper)
  
      return out.astype(ret_dtype)
  
imports: from typing import Optional, Union, Tuple, Sequence
  import numpy
  import math
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes
  from .None import backend_version
  from ..statistical import _infer_dtype
  from copy import deepcopy
label_desc: Use image node_id 9 for calling a global function with example usage: _quantile(a, q, axis) and returns: out