Get connection class by adapter

def connection_class(self, adapter):
        """Get connection class by adapter"""
        if self.adapters.get(adapter):
            return self.adapters[adapter]
        try:
            class_prefix = getattr(
                __import__('db.' + adapter, globals(), locals(),
                           ['__class_prefix__']), '__class_prefix__')
            driver = self._import_class('db.' + adapter + '.connection.' +
                                        class_prefix + 'Connection')
        except ImportError:
            raise DBError("Must install adapter `%s` or doesn't support" %
                          (adapter))

        self.adapters[adapter] = driver
        return driver