Restrict get_logger to work with classes/functions

Its not used with anything else anyway.
Backport NullHandler for python2.6 support.