def __getitem__(self, item):
if not hasattr(self, '<STR_LIT>'):<EOL><INDENT>self.update_hdu_list()<EOL><DEDENT>ext, ver, ver_sent = self._extract_item(item)<EOL>try:<EOL><INDENT>hdu = self.hdu_list[ext]<EOL><DEDENT>except Exception:<EOL><INDENT>ext = mks(ext)<EOL>if not self.case_sensitive:<EOL><INDENT>mess = '<STR_LIT>'<EOL>ext = ext.lower()<EOL><DEDENT>else:<EOL><INDENT>mess = '<STR_LIT>'<EOL><DEDENT>if ver > <NUM_LIT:0>:<EOL><INDENT>key = '<STR_LIT>' % (ext, ver)<EOL>if key not in self.hdu_map:<EOL><INDENT>raise IOError("<STR_LIT>"<EOL>"<STR_LIT>" % (ext, ver, mess))<EOL><DEDENT>hdu = self.hdu_map[key]<EOL><DEDENT>else:<EOL><INDENT>if ext not in self.hdu_map:<EOL><INDENT>raise IOError("<STR_LIT>" % (ext, mess))<EOL><DEDENT>hdu = self.hdu_map[ext]<EOL><DEDENT><DEDENT>return hdu<EOL>
Get an hdu by number, name, and possibly version