code: def get_collection(self, **kwargs):
          
          from pymongo import MongoClient
  
          if self.host and self.port:
              client = MongoClient(host=config.host, port=config.port)
          else:
              client = MongoClient()
          db = client[self.dbname]
  
          # Authenticate if needed
          if self.user and self.password:
              db.autenticate(self.user, password=self.password)
  
          return db[self.collection]
docs: Establish a connection with the database.
  
          Returns MongoDb collection