Behaves similarly to LDAPObject.search_ext_s() but internally uses the
        simple paged results control to retrieve search results in chunks.

        Taken from the python-ldap paged_search_ext_s.py demo, showing how to use
        the paged results control: https://bitbucket.org/jaraco/python-ldap/

def _paged_search_ext_s(self, base, scope, filterstr='(objectClass=*)', attrlist=None, attrsonly=0,
                            serverctrls=None, clientctrls=None, timeout=-1, sizelimit=0, page_size=10):
        """
        Behaves similarly to LDAPObject.search_ext_s() but internally uses the
        simple paged results control to retrieve search results in chunks.

        Taken from the python-ldap paged_search_ext_s.py demo, showing how to use
        the paged results control: https://bitbucket.org/jaraco/python-ldap/
        """
        request_ctrl = SimplePagedResultsControl(True, size=page_size, cookie='')
        results = []

        while True:
            msgid = self.conn.search_ext(base, scope, filterstr=filterstr, attrlist=attrlist, attrsonly=attrsonly,
                                         serverctrls=(serverctrls or []) + [request_ctrl], clientctrls=clientctrls,
                                         timeout=timeout, sizelimit=sizelimit)
            result_type, result_data, result_msgid, result_ctrls = self.conn.result3(msgid)
            results.extend(result_data)

            # Extract the simple paged results response control
            paged_ctrls = [c for c in result_ctrls if c.controlType == SimplePagedResultsControl.controlType]

            if paged_ctrls and paged_ctrls[0].cookie:
                # Copy cookie from response control to request control
                request_ctrl.cookie = paged_ctrls[0].cookie
            else:
                break

        return results