def watch(filenames, callback, use_sudo=False):
    """Call callback if any of filenames change during the context"""
    filenames = [filenames] if isinstance(filenames, basestring) else filenames
    old_md5 = {fn: md5sum(fn, use_sudo) for fn in filenames}
    yield
    for filename in filenames:
        if md5sum(filename, use_sudo) != old_md5[filename]:
            callback()
            return
Call callback if any of filenames change during the context