def filter_completions(self, completions):
<EOL>if USING_PYTHON2:<EOL><INDENT>for i in range(len(completions)):<EOL><INDENT>if type(completions[i]) != unicode:<EOL><INDENT>completions[i] = completions[i].decode(sys_encoding)<EOL><DEDENT><DEDENT><DEDENT>if self.exclude is None:<EOL><INDENT>self.exclude = set()<EOL><DEDENT>seen = set(self.exclude)<EOL>return [c for c in completions if c not in seen and not seen.add(c)]<EOL>
Ensures collected completions are Unicode text, de-duplicates them, and excludes those specified by ``exclude``.
Returns the filtered completions as an iterable.

This method is exposed for overriding in subclasses; there is no need to use it directly.