def update_headers(src_tree):
    """Main."""
    print("src tree", src_tree)
    for root, dirs, files in os.walk(src_tree):
        py_files = fnmatch.filter(files, "*.py")
        for f in py_files:
            print("checking", f)
            p = os.path.join(root, f)
            with open(p) as fh:
                contents = fh.read()
            if suffix in contents:
                continue
            print("Adding license header to %s" % p)
            with open(p, 'w') as fh:
                fh.write(
                    '%s%s%s' % (header, suffix, contents))
Main.