): #!/usr/bin/env python0 """Usage: grep-tail <regex> <file>""" import collections import functools import re import sys import tkinter.messagebox  def filter_lastline(file, predicate):     """Find the last line in *file* that satisfies *predicate*."""     lines = collections.deque(filter(predicate, file), maxlen=0)     try:         return lines.pop().rstrip('\n')     except IndexError:         return ''  # not found  def update_label(root, label, last_line):     current = label['text']     new = last_line()     if new and current != new:         label['text'] = new  # update label  