Scale mesh to fit into -1..1 cube

def normalize_mesh(mesh):
  '''Scale mesh to fit into -1..1 cube'''
  mesh = dict(mesh)
  pos = mesh['position'][:,:3].copy()
  pos -= (pos.max(0)+pos.min(0)) / 2.0
  pos /= np.abs(pos).max()
  mesh['position'] = pos
  return mesh