[core] Migrate from optparse to argparse

optparse is deprecated since Python 2.7. This commit migrates the code to
the newer module, argparse, which also simplifies our code a bit.

Fixes #445
[core] use from __future__ import print_function

This will make life easier when we port to Python 3.