Conditionally import pymongo, fix handlers kwarg

Only import pymongo if the module is present on the machine. Changes the
handlers keyword argument from an empty array to a None type to prevent
modification of the defaults.
Remove unnecessary imports, make logger non-global

pymongo code has been refactored, remove the lingering imports. logger
is no longer a global variable.