input: Write a function to optimize a given multivariate function using the `scipy.optimize` library. The function should take a function and an initial guess as input and return the optimized values of the variables. If the optimization fails, it should handle the exception appropriately and return an error message.
  
  import scipy.optimize as opt 
  import numpy as np
  
  def optimize_function(function, initial_guess): 
      try:
          result = opt.minimize(function, initial_guess) 
          return result.x
      except Exception as e:
          return f"Optimization failed: {str(e)}"
  
  assert np.allclose(optimize_function(lambda x: x[0]**2 + x[1]**2, [1, 1]), [0, 0])
  assert optimize_function(lambda x: sum(x), [1, 2, 3]) == [1, 2, 3]
  assert "failed" in optimize_function(lambda x: 1/x[0], [0])
  assert "failed" in optimize_function(lambda x: np.sum(x), [])
output: def optimize_function(function, initial_guess): 
      try:
          result = opt.minimize(function, initial_guess) 
          return result.x
      except Exception as e:
          return f"Optimization failed: {str(e)}"