code: def get_new_connection(self, conn_params):
          
          connection = ldap.ldapobject.ReconnectLDAPObject(
              uri=conn_params['uri'],
              retry_max=conn_params['retry_max'],
              retry_delay=conn_params['retry_delay'],
              bytes_mode=False)
  
          options = conn_params['options']
          for opt, value in options.items():
              if opt == 'query_timeout':
                  connection.timeout = int(value)
              elif opt == 'page_size':
                  self.page_size = int(value)
              else:
                  connection.set_option(opt, value)
  
          if conn_params['tls']:
              connection.start_tls_s()
  
          connection.simple_bind_s(
              conn_params['bind_dn'],
              conn_params['bind_pw'],
          )
          return connection
docs: Build a connection from its parameters.