def _check(self, mode=None):
        """Check if TarFile is still open, and if the operation's mode
           corresponds to TarFile's mode.
        """
        if self.closed:
            raise IOError("%s is closed" % self.__class__.__name__)
        if mode is not None and self.mode not in mode:
            raise IOError("bad operation for mode %r" % self.mode)
def _check ( self , mode = None ) : if self . closed : raise IOError ( "%s is closed" % self . __class__ . __name__ ) if mode is not None and self . mode not in mode : raise IOError ( "bad operation for mode %r" % self . mode )
Check if TarFile is still open, and if the operation's mode
           corresponds to TarFile's mode.