def modified(path, prev=None):
    """if prev is None, calculates a state to be later passed to modified().
if prev is such a state,
modified() will return wether the path has been modified or not."""
    dirs = []
    files = []
    for n in os.listdir(path):
        ap = os.path.join(path, n)
        if os.path.isfile(ap):
            stat = os.stat(ap)
            size = stat.st_size
            mod = stat.st_mtime
            files.append((ap, size, mod))
        else:
            res = modified(ap, prev=None)
            dirs += res[0]
            files += res[1]
    if prev is None:
        return (dirs, files)
    else:
        return prev != (dirs, files)
if prev is None, calculates a state to be later passed to modified().
if prev is such a state,
modified() will return wether the path has been modified or not.
bin/mc.py