Rewrite to work with Python 2 and 3

Also restructure a little, making it safe to load and use as a module.
Add a feature to give min and max length

Also more informative warnings when choosing potentially insecure
options and move some more logic into the password generator.