def METHOD_NAME(info, packages_path=None, cached=True, random_state=None):
    """
    Chooses optimal covmat from a database, based on common parameters and likelihoods.
    Returns a dict `{folder: [folder_of_covmat], name: [file_name_of_covmat],
    params: [parameters_in_covmat], covmat: [covariance_matrix]}`.
    """
    packages_path = packages_path or info.get(packages_path_input)
    if not packages_path:
        raise LoggedError(log, "Needs a path to the external packages' installation.")
    updated_info = update_info(info, strict=False)
    for p, pinfo in list(updated_info["params"].items()):
        if not is_sampled_param(pinfo):
            updated_info["params"].pop(p)
    info_sampled_params = updated_info["params"]
    covmat_data = get_best_covmat_ext(packages_path, updated_info["params"],
                                      updated_info["likelihood"], random_state, cached)
    if covmat_data is None:
        return None
    covmat = np.atleast_2d(np.loadtxt(os.path.join(
        covmat_data["folder"].format(packages_path=packages_path), covmat_data["name"])))
    params_in_covmat = get_translated_params(info_sampled_params, covmat_data["params"])
    indices = [covmat_data["params"].index(p) for p in params_in_covmat.values()]
    covmat_data["covmat"] = covmat[indices][:, indices]
    covmat_data["params"] = params_in_covmat
    return covmat_data