@classmethod<EOL><INDENT>def bz2open(cls, name, mode="<STR_LIT:r>", fileobj=None, compresslevel=<NUM_LIT:9>, **kwargs):<DEDENT>
if len(mode) > <NUM_LIT:1> or mode not in "<STR_LIT>":<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>try:<EOL><INDENT>import bz2<EOL><DEDENT>except ImportError:<EOL><INDENT>raise CompressionError("<STR_LIT>")<EOL><DEDENT>if fileobj is not None:<EOL><INDENT>fileobj = _BZ2Proxy(fileobj, mode)<EOL><DEDENT>else:<EOL><INDENT>fileobj = bz2.BZ2File(name, mode, compresslevel=compresslevel)<EOL><DEDENT>try:<EOL><INDENT>t = cls.taropen(name, mode, fileobj, **kwargs)<EOL><DEDENT>except (IOError, EOFError):<EOL><INDENT>fileobj.close()<EOL>raise ReadError("<STR_LIT>")<EOL><DEDENT>t._extfileobj = False<EOL>return t<EOL>
Open bzip2 compressed tar archive name for reading or writing.
           Appending is not allowed.