`os.path.getmtime` also works well and has the bonus of not returning a bunch of info you don't need. This is just a nit though, not a required change for r+.