def open_only(func):
 @wraps(func)
 def _check(self, *args, **kwds):
  if (self.closed or self.eof_received or self.eof_sent or (not self.active)):
   raise SSHException('Channel is not open')
  return func(self, *args, **kwds)
 return _check

def open_only ( func ) : @ wraps ( func ) def _check ( self , * args , ** kwds ) : if ( self . closed or self . eof_received or self . eof_sent or ( not self . active ) ) : raise SSHException ( 'Channel is not open' ) return func ( self , * args , ** kwds ) return _check
decorator for .