def get_max_return(self, weights, returns):
        """
        Maximizes the returns of a portfolio.
        """

        def func(weights):
            """The objective function that maximizes returns."""
            return np.dot(weights, returns.values) * -1

        constraints = ({'type': 'eq', 'fun': lambda weights: (weights.sum() - 1)})
        solution = self.solve_minimize(func, weights, constraints)
        max_return = solution.fun * -1

        # NOTE: `max_risk` is not used anywhere, but may be helpful in the future.
        # allocation = solution.x
        # max_risk = np.matmul(
        #     np.matmul(allocation.transpose(), cov_matrix), allocation
        # )

        return max_return
Maximizes the returns of a portfolio.