Updated misc lib with improvements from other projects.
Don't leave home without misc.py :)