def __contains__(self, item):
if isinstance(item, TokenWithPosition):<EOL><INDENT>return item.text in self.text<EOL><DEDENT>return item in self.text<EOL>
>>> 'rg' in TokenWithPosition('corgi', 0)
True
>>> 'reg' in TokenWithPosition('corgi', 0)
False
>>> TokenWithPosition('rg', 0) in TokenWithPosition('corgi', 0)
True