def extract(self, document, selector, debug_offset='<STR_LIT>'):
selected = self.select(document, selector)<EOL>if selected is not None:<EOL><INDENT>if isinstance(selected, (list, tuple)):<EOL><INDENT>if not len(selected):<EOL><INDENT>return<EOL><DEDENT>return [self._extract_single(m) for m in selected]<EOL><DEDENT>else:<EOL><INDENT>return self._extract_single(selected)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if self.DEBUG:<EOL><INDENT>print(debug_offset, "<STR_LIT>")<EOL><DEDENT>return None<EOL><DEDENT>
Try and convert matching Elements to unicode strings.

If this fails, the selector evaluation probably already
returned some string(s) of some sort, or boolean value,
or int/float, so return that instead.