code: def _moveaxis(a, source, destination, xp):
      if hasattr(xp, "moveaxis"):
          return xp.moveaxis(a, source, destination)
      if not all(
          isinstance(axis, six.integer_types) for axis in source
      ):
          raise TypeError("int or tuple of int are required.")
      if not all(
          isinstance(axis, six.integer_types) for axis in destination
      ):
          raise TypeError("int or tuple of int are required.")
      if len(source) != len(destination):
          raise ValueError(
              "Length of source and destination are " "different."
          )
  
      source = _normalize_axis_tuple(source, a.ndim)
      destination = _normalize_axis_tuple(destination, a.ndim)
  
      if len(set(source)) != len(source):
          raise ValueError(
              "duplicate value in source axis: ({})".format(
                  ", ".join(map(str, source))
              )
          )
      if len(set(destination)) != len(destination):
          raise ValueError(
              "duplicate value in destination axis: ({})".format(
                  ", ".join(map(str, destination))
              )
          )
  
      order = [n for n in six.moves.range(a.ndim) if n not in source]
  
      for dest, src in sorted(six.moves.zip(destination, source)):
          order.insert(dest, src)
  
      result = a.transpose(order)
      return result
  
file_path: chainer/chainer/functions/array/moveaxis.py
imports: import six
  from chainer import backend
  from chainer import function_node
  from chainer.utils import type_check
label_desc: Use image node_id 2 for calling a global function with example usage: _moveaxis(a, source, destination, xp) and returns: result, xp