Updated API utils with optparse.

Many settings were controlled by module-level constants, or magic numbers in code. These are now removed in favor of being provided from the commandline, with some sensible defaults (said previous constants). This provides a more friendly interface to the user and provides for some basic commandline documentation.

Optparse was chosen in favor of argparse to maintain compatibility with older versions of Python (2.6) that are still in wide circulation.