import re


def _parse_minimap_log(log_filename):
    """Parses minimap log file and returns
    i string) version, float ii) peak RAM"""

    version = ""
    RAM = 0.0

    try:
        logfile = open(log_filename)
    except OSError as error:
        print("# ERROR: cannot open/read file:", log_filename, error)
        return version

    for line in logfile:
        vre = re.search(r"Version: (\S+)", line)
        if vre:
            version = vre.group(1)

        ramre = re.search(r"Peak RSS+: (\S+)", line)
        if ramre:
            RAM = float(ramre.group(1))
            break

    logfile.close
    return version, RAM