<s> from rx import Lock <EOL> class InnerSubscription ( object ) : <EOL> def __init__ ( self , subject , observer ) : <EOL> self . subject = subject <EOL> self . observer = observer <EOL> self . lock = Lock ( ) <EOL> def dispose ( self ) : <EOL> with self . lock : <EOL> if not self . subject . is_disposed and self . observer : <EOL> if self . observer in self . subject . observers : <EOL> self . subject . observers . remove ( self . observer ) <EOL> self . observer = None </s>
