def open(self, member, pwd=None):
if isinstance(member, RarInfo):<EOL><INDENT>member = member.filename<EOL><DEDENT>archive = unrarlib.RAROpenArchiveDataEx(<EOL>self.filename, mode=constants.RAR_OM_EXTRACT)<EOL>handle = self._open(archive)<EOL>password = pwd or self.pwd<EOL>if password is not None:<EOL><INDENT>unrarlib.RARSetPassword(handle, b(password))<EOL><DEDENT>data = _ReadIntoMemory()<EOL>c_callback = unrarlib.UNRARCALLBACK(data._callback)<EOL>unrarlib.RARSetCallback(handle, c_callback, <NUM_LIT:0>)<EOL>try:<EOL><INDENT>rarinfo = self._read_header(handle)<EOL>while rarinfo is not None:<EOL><INDENT>if rarinfo.filename == member:<EOL><INDENT>self._process_current(handle, constants.RAR_TEST)<EOL>break<EOL><DEDENT>else:<EOL><INDENT>self._process_current(handle, constants.RAR_SKIP)<EOL><DEDENT>rarinfo = self._read_header(handle)<EOL><DEDENT>if rarinfo is None:<EOL><INDENT>data = None<EOL><DEDENT><DEDENT>except unrarlib.MissingPassword:<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT>except unrarlib.BadPassword:<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT>except unrarlib.BadDataError:<EOL><INDENT>if password is not None:<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT><DEDENT>except unrarlib.UnrarException as e:<EOL><INDENT>raise BadRarFile("<STR_LIT>" % str(e))<EOL><DEDENT>finally:<EOL><INDENT>self._close(handle)<EOL><DEDENT>if data is None:<EOL><INDENT>raise KeyError('<STR_LIT>' % member)<EOL><DEDENT>return data.get_bytes()<EOL>
Return file-like object for 'member'.

           'member' may be a filename or a RarInfo object.