code: def connection(self):
          
          c = pymongo.MongoClient(
              self.hostname, fsync=True,
              socketTimeoutMS=self.socket_timeout, **self.kwargs)
          connected(c)
          if not self.is_mongos and self.login and not self.restart_required:
              db = c[self.auth_source]
              if self.x509_extra_user:
                  auth_dict = {
                      'name': DEFAULT_SUBJECT, 'mechanism': 'MONGODB-X509'}
              else:
                  auth_dict = {'name': self.login, 'password': self.password}
              try:
                  db.authenticate(**auth_dict)
              except:
                  logger.exception("Could not authenticate to %s with %r"
                                   % (self.hostname, auth_dict))
                  raise
          return c
docs: return authenticated connection