@contextmanager<EOL><INDENT>def visit(self, key):<DEDENT>
self[key] = key<EOL>try:<EOL><INDENT>yield key<EOL><DEDENT>finally:<EOL><INDENT>del self[key]<EOL><DEDENT>
Visits key and marks as visited.
        Support context manager interface.

        :param key: key being visited.