def execute(self, connection, filterargs=(), escape=True):
if escape:<EOL><INDENT>filterargs = self._escape_filterargs(filterargs)<EOL><DEDENT>try:<EOL><INDENT>filterstr = self.filterstr % filterargs<EOL>results = connection.search_s(force_str(self.base_dn),<EOL>self.scope,<EOL>force_str(filterstr))<EOL><DEDENT>except ldap.LDAPError as e:<EOL><INDENT>results = []<EOL>logger.error(u"<STR_LIT>" %<EOL>(self.base_dn, self.scope, filterstr, pprint.pformat(e)))<EOL><DEDENT>return self._process_results(results)<EOL>
Executes the search on the given connection (an LDAPObject). filterargs
is an object that will be used for expansion of the filter string.
If escape is True, values in filterargs will be escaped.

The python-ldap library returns utf8-encoded strings. For the sake of
sanity, this method will decode all result strings and return them as
Unicode.