get_theta_hat.function <- function(test_mean, ..., ftheta, Y, Q, control){
  optimization_output <-
    calc_theta_hat(ftheta = ftheta, Y = Y, Q = Q,
                   optimization_fun = control[["optimization_fun"]],
                   optimization_args = control[["optimization_args"]],
                   fun_to_optimize_arg = control[["fun_to_optimize_arg"]])
  theta_hat <- optimization_output[[control[["theta_hat_name"]]]]
  if(is.null(theta_hat))
    stop("No element with name '", control[["theta_hat_name"]],
         "' found in optimization output")
  return(optimization_output)
}