Fix python3.10 compatibility
This is a cross-project cherry-pick of https://git.ligo.org/kipp.cannon/python-ligo-lw/-/commit/93ecb764202ee8cb56722441eb339fd1e719b5aa
All credit goes to @kipp.cannon for the fix, I've just translated the filenames to work in this project.