Finds all sgf files in base_dir with year >= min_year and komi

def find_and_filter_sgf_files(base_dir, min_year=None, komi=None):
    """Finds all sgf files in base_dir with year >= min_year and komi"""
    sgf_files = []
    for dirpath, dirnames, filenames in os.walk(base_dir):
        for filename in filenames:
            if filename.endswith('.sgf'):
                path = os.path.join(dirpath, filename)
                sgf_files.append(path)

    if min_year == komi == None:
        print ("Found {} sgf_files".format(len(sgf_files)))
        return sgf_files

    f = filter_year_komi(min_year, komi)
    filtered_sgf_files = [sgf for sgf in tqdm(sgf_files) if f(sgf)]

    print("{} of {} .sgf files matched (min_year >= {}, komi = {})".format(
        len(filtered_sgf_files), len(sgf_files), min_year, komi))
    return filtered_sgf_files