- don't fail, when the directory doesn't exist but create it instead
- handle failures to create the output directory properly
- use f-string formatting to simplify building the output filename
- use OS-independent `os.path.join` to build the output path