Use basename in determination of output/input type in monty serialization
Use basename in determination of output/input type in monty serialization

I encountered a somewhat weird error recently when using monty serialization in that temporary filenames generated by both standard library tempfile and monty's tempfile tools would occasionally have "mpk" in the absolute paths of filenames.  This would result in inconsistent errors in integration tests when I was using temporary directories to test file output routines.  

Example:
```
dumpfn({"var_1": 1}, "tmp123MpK/output.json")
```

I dunno if it's really worth it, but this might be avoided by inferring the serialization format from a basename of the filename, rather than just the filename, which could include the path.
gmatteo/monty,davidwaroquiers/monty,gmatteo/monty,materialsvirtuallab/monty,davidwaroquiers/monty,materialsvirtuallab/monty