code: def scalar_reshape(a, newshape, order='C'):
      
      if newshape == ():
          return np.asscalar(a)
  
      if newshape == (0,):
          return []
  
      return np.reshape(a, newshape, order)
docs: Reshape, but also return scalars or empty lists.
  
      Identical to `numpy.reshape` except in the case where `newshape` is
      the empty tuple, in which case we return a scalar instead of a
      0-dimensional array.
  
      Examples
      --------
      >>> a = np.arange(6)
      >>> np.array_equal(np.reshape(a, (3, 2)), scalar_reshape(a, (3, 2)))
      True
  
      >>> scalar_reshape(np.array([3.14]), newshape=())
      3.14
  
      >>> scalar_reshape(np.array([2.71]), newshape=(1,))
      array([ 2.71])
  
      >>> scalar_reshape(np.array([]), newshape=(0,))
      []