code: def flip(a, axis):
      
      if not hasattr(a, 'ndim'):
          a = np.asarray(a)
      indexer = [slice(None)] * a.ndim
      try:
          indexer[axis] = slice(None, None, -1)
      except IndexError:
          raise ValueError('axis={} is invalid for the {}-dimensional input '
                           'array'.format(axis, a.ndim))
      return a[tuple(indexer)]
docs: Reverse the order of elements in an array along the given axis.
  
      This function is a backport of `numpy.flip` introduced in NumPy 1.12.
  
      See Also
      --------
      numpy.flip