code: def search(self, filter, attributes=None):
          
          if attributes is None:
              attributes = ['*']
  
          if filter is None:
              filter = ["(objectclass=*)"]
  
          # Convert filter list into an LDAP-consumable format
          filterstr = "(&{})".format(''.join(filter))
          self.conn.search(
              search_base=self.basedn,
              search_filter=filterstr,
              search_scope=ldap3.SUBTREE,
              attributes=attributes)
          return self.conn.entries
docs: Search LDAP for records.