input: Write a python function to calculate the optimal weights of a portfolio based on mean returns and covariance matrix of assets using scipy's minimize function.
  assert isinstance(minimize_func(np.array([0.1, 0.2, 0.15]), np.array([[0.005, -0.010, 0.004], 
                                                                       [-0.010, 0.040, -0.002], 
                                                                       [0.004, -0.002, 0.023]])), np.ndarray)
  assert sum(minimize_func(np.array([0.1, 0.2, 0.15]), np.array([[0.005, -0.010, 0.004], 
                                                                 [-0.010, 0.040, -0.002], 
                                                                 [0.004, -0.002, 0.023]]))) == 1.0
output: from scipy.optimize import minimize
  import numpy as np
  
  def minimize_func(mean_returns, cov_matrix):
      num_assets = len(mean_returns)
      
      def portfolio_variance(weights):
          return np.dot(weights.T, np.dot(cov_matrix, weights))
      
      constraints = ({'type': 'eq', 'fun': lambda x: np.sum(x) - 1})
      bounds = tuple((0, 1) for _ in range(num_assets))
      initial_guess = num_assets * [1. / num_assets]
      
      result = minimize(portfolio_variance, initial_guess, method='SLSQP', bounds=bounds, constraints=constraints)
      
      return result.x