code: def _validate_sort_arguments(
      a, axis, kind, parallel_kind, psrs_kinds, order
  ):
      a = astensor(a)
      if axis is None:
          a = a.flatten()
          axis = 0
      else:
          axis = validate_axis(a.ndim, axis)
      if kind is not None:
          raw_kind = kind
          kind = kind.upper()
          if kind not in _AVAILABLE_KINDS:
              # check kind
              raise ValueError(
                  f"{raw_kind} is an unrecognized kind of sort"
              )
      if parallel_kind is not None:
          raw_parallel_kind = parallel_kind
          parallel_kind = parallel_kind.upper()
          if parallel_kind not in {"PSRS"}:
              raise ValueError(
                  f"{raw_parallel_kind} is an unrecognized kind of parallel sort"
              )
  
      order = validate_order(a.dtype, order)
      psrs_kinds = _validate_sort_psrs_kinds(psrs_kinds)
      return a, axis, kind, parallel_kind, psrs_kinds, order
  
imports: import numpy
  from ...None import opcodes
  from ...serialization.serializables import FieldTypes, Int32Field, StringField, ListField, BoolField
  from ...core import ExecutableTuple
  from ..array_utils import as_same_device, device
  from ..core import TensorOrder
  from ..datasource import tensor
  from ..operands import TensorOperand, TensorShuffleProxy
  from ..utils import validate_axis, validate_order
  from .psrs import TensorPSRSOperandMixin
label_desc: Use image node_id 2 for calling a global function with example usage: _validate_sort_arguments(a, axis, kind, parallel_kind, psrs_kinds, order) and returns: a,  axis,  kind,  parallel_kind,  psrs_kinds,  order