Remove code duplication

Remove code duplication from impl_mongodb and impl_db2 as both of
these drivers use pymongo. This is a multiple step process as there
are several differences between the implementation of these drivers.

The first step is about to move the identical functions to a common
base file, called pymongo_base with a Connection class, from which
the Connection class of both drivers will be inherited.

Change-Id: Ib3c250213cda5450c96c6e495f56623ed7ac0490