FILEIO: Make fileio.py into a more general purpose utility with command line arguments.

Also Add doc strings to python functions.