def count_lines(filename):
    """Open file, count newlines, then return (filename, line_count) tuple."""
    with open(filename, 'rb') as file_to_read:
        chunk_size = 8192
        line_count = 0
        while True:
            chunk = file_to_read.read(chunk_size)
            if chunk:
                line_count += chunk.count(b'\n')
            else:
                break
        return filename, line_count