code: def mongodb_auth_uri(self, hosts):
          
          parts = ['mongodb://']
          if self.login:
              parts.append(self.login)
              if self.password:
                  parts.append(':' + self.password)
              parts.append('@')
          parts.append(hosts + '/')
          if self.login:
              parts.append('?authSource=' + self.auth_source)
              if self.x509_extra_user:
                  parts.append('&authMechanism=MONGODB-X509')
          return ''.join(parts)
docs: Get a connection string with all info necessary to authenticate.