def genome_size(peaks_file, haploid=True):
    """
    Finds the genome size of an organsim, based on the peaks file created by kmercountexact.sh
    :param peaks_file: Path to peaks file created by kmercountexact.
    :param haploid: Set to True if organism of interest is haploid, False if not. Default True.
    :return: size of genome, as an int. If size could not be found, return will be 0.
    """
    size = 0
    with open(peaks_file) as peaks:
        lines = peaks.readlines()
    for line in lines:
        if haploid:
            if '#haploid_genome_size' in line:
                size = int(line.split()[1])
        elif '#genome_size' in line:
            size = int(line.split()[1])
    return size
