def count_lines(filename):
    """Count the number of lines in a source file

        Return a pair (n0, n1), where n0 is the total
        number of lines, while n1 is the number of non-empty
        lines
    """

    with open(filename) as f:
        lines = f.readlines()

    n0 = len(lines)
    n1 = 0
    for line in lines:
        line = line.strip()
        if len(line) > 0:
            n1 += 1

    return (n0, n1)