code: def _calc_order(a, index):
      if a.order == TensorOrder.C_ORDER:
          return TensorOrder.C_ORDER
  
      in_axis = 0
      for ind in index:
          if _is_bool_index(ind):
              in_axis += ind.ndim
              return TensorOrder.C_ORDER
          elif _is_fancy_index(ind):
              in_axis += 1
              return TensorOrder.C_ORDER
          elif ind is None:
              continue
          elif isinstance(ind, slice):
              shape = a.shape[in_axis]
              slc = ind.indices(shape)
              if slc[0] == 0 and slc[1] == shape and slc[2] == 1:
                  continue
              else:
                  return TensorOrder.C_ORDER
          else:
              assert isinstance(ind, Integral)
              in_axis += 1
              return TensorOrder.C_ORDER
  
      return TensorOrder.F_ORDER
  
imports: from numbers import Integral
  import numpy
  from ...None import opcodes
  from ...core import ENTITY_TYPE
  from ...core.operand import OperandStage
  from ...serialization.serializables import FieldTypes, KeyField, ListField, TupleField, Int32Field
  from ..core import TENSOR_TYPE, TensorOrder
  from ..utils import split_indexes_into_chunks, calc_pos, filter_inputs
  from ..operands import TensorHasInput, TensorOperandMixin, TensorMapReduceOperand
  from ..array_utils import get_array_module
  from .core import process_index, calc_shape
  from .index_lib import TensorIndexesHandler
label_desc: Use image node_id 4 for calling a global function with example usage: _calc_order(a, index) and returns: TensorOrder, TensorOrder, TensorOrder, TensorOrder, TensorOrder, TensorOrder