modules all platforms without having to remember the differences between dir and ls create program that supports the following interfaceusagels py [options[path [path pathn]]the paths are optionalif not given is used options- --help show this help message and exit - --hidden show hidden files [defaultoff- --modified show last modified date/time [defaultoff- order--order=order order by ('name'' ''modified'' ''size'' '[defaultname- --recursive recurse into subdirectories [defaultoff- --sizes show sizes [defaultoff(the output has been modified slightly to fit the book' page here is an example of output on small directory using the command line ls py -ms -os misc/ : : : : : : , misc/abstract pdf , misc/klmqtintro lyx , , misc/tracking pdf misc/phonelog files directory we used option grouping in the command line (optparse handles this automatically for us)but the same could have been achieved using separate optionsfor examplels py - - -os misc/or by even more groupingls py -msos misc/or by using long optionsls py --modified --sizes --order=size misc/or any combination of these note that we define "hiddenfile or directory as one whose name begins with dot the exercise is quite challenging you will need to read the optparse documentation to see how to provide options that set true valueand how to offer fixed list of choices if the user sets the recursive option you will need to process the files (but not the directoriesusing os walk()otherwiseyou will have to use os listdir(and process both files and directories yourself one rather tricky aspect is avoiding hidden directories when recursing they can be cut out of os walk()' dirs list--and therefore skipped by os walk()--by modifying that list but be careful not to assign to the dirs variable itselfsince that won' change the list it refers to but will simply (and uselesslyreplace itthe approach used in the model solution is to assign to slice of the whole listthat isdirs[:[dir for dir in dirs if not dir startswith(")locale setlocale( the best way to get grouping characters in the file sizes is to import the locale modulecall locale setlocale(to get the user' default localeand use the format character overallls py is about lines split over four functions