def _extract_problem_info(source):
    """Split the logpath to identify test problem, data set, etc.

    Args:
        source (Cockpit or str): ``Cockpit`` instance, or string containing the
                path to a .json log produced with ``Cockpit.write``, where
                information will be fetched from.

    Returns:
        [dict]: Dictioniary of logpath, testproblem, optimizer, etc.
    """
    if isinstance(source, str):
        # Split logpath if possible
        try:
            dicty = {
                "logpath": source + ".json",
                "optimizer": source.split("/")[-3],
                "testproblem": source.split("/")[-4],
                "dataset": source.split("/")[-4].split("_", 1)[0],
                "model": source.split("/")[-4].split("_", 1)[1],
            }
        except Exception:
            dicty = {
                "logpath": source + ".json",
                "optimizer": "",
                "testproblem": "",
                "dataset": "",
                "model": "",
            }
    else:
        # Source is Cockpit instance
        dicty = {
            "logpath": "",
            "optimizer": source._optimizer_name,
            "testproblem": "",
            "dataset": "",
            "model": "",
        }
    return dicty