code: def normalize(v):
      '''Normalize a vector based on its 2 norm.'''
      if 0 == np.linalg.norm(v):
          return v
      return v / np.linalg.norm(vf normalize(v):
      '''Normalize a vector based on its 2 norm.'''
      if 0 == np.linalg.norm(v):
          return v
      return v / np.linalg.norm(v)
docs: Normalize a vector based on its 2 norm.