code: def _to_positive_axis(axis, ndim):
      if not isinstance(axis, (list, tuple)):
          axis = [axis]
  
      if len(axis) == 0:
          raise ValueError("Axis can't be empty!")
  
      if len(set(axis)) != len(axis):
          raise ValueError("Duplicated axis!")
  
      for i in range(len(axis)):
          if not (
              isinstance(axis[i], int) and (ndim > axis[i] >= -ndim)
          ):
              raise ValueError(
                  "Axis must be int in range [-rank(x), rank(x))"
              )
          if axis[i] < 0:
              axis[i] += ndim
      return axis
  
imports: from typing import Optional, Union, Tuple, Sequence
  import torch
  from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
  from .None import backend_version
  import ivy
  from ..statistical import _infer_dtype
  from copy import deepcopy
label_desc: Use image node_id 7 for calling a global function with example usage: _to_positive_axis(axis, ndim) and returns: axis