def readheaders(self):
self.dict = {}<EOL>self.unixfrom = '<STR_LIT>'<EOL>self.headers = lst = []<EOL>self.status = '<STR_LIT>'<EOL>headerseen = "<STR_LIT>"<EOL>firstline = <NUM_LIT:1><EOL>startofline = unread = tell = None<EOL>if hasattr(self.fp, '<STR_LIT>'):<EOL><INDENT>unread = self.fp.unread<EOL><DEDENT>elif self.seekable:<EOL><INDENT>tell = self.fp.tell<EOL><DEDENT>while <NUM_LIT:1>:<EOL><INDENT>if tell:<EOL><INDENT>try:<EOL><INDENT>startofline = tell()<EOL><DEDENT>except IOError:<EOL><INDENT>startofline = tell = None<EOL>self.seekable = <NUM_LIT:0><EOL><DEDENT><DEDENT>line = self.fp.readline()<EOL>if not line:<EOL><INDENT>self.status = '<STR_LIT>'<EOL>break<EOL><DEDENT>if firstline and line.startswith('<STR_LIT>'):<EOL><INDENT>self.unixfrom = self.unixfrom + line<EOL>continue<EOL><DEDENT>firstline = <NUM_LIT:0><EOL>if headerseen and line[<NUM_LIT:0>] in '<STR_LIT>':<EOL><INDENT>lst.append(line)<EOL>x = (self.dict[headerseen] + "<STR_LIT>" + line.strip())<EOL>self.dict[headerseen] = x.strip()<EOL>continue<EOL><DEDENT>elif self.iscomment(line):<EOL><INDENT>continue<EOL><DEDENT>elif self.islast(line):<EOL><INDENT>break<EOL><DEDENT>headerseen = self.isheader(line)<EOL>if headerseen:<EOL><INDENT>lst.append(line)<EOL>self.dict[headerseen] = line[len(headerseen)+<NUM_LIT:1>:].strip()<EOL>continue<EOL><DEDENT>elif headerseen is not None:<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>if not self.dict:<EOL><INDENT>self.status = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>self.status = '<STR_LIT>'<EOL><DEDENT>if unread:<EOL><INDENT>unread(line)<EOL><DEDENT>elif tell:<EOL><INDENT>self.fp.seek(startofline)<EOL><DEDENT>else:<EOL><INDENT>self.status = self.status + '<STR_LIT>'<EOL><DEDENT>break<EOL><DEDENT><DEDENT>
Read header lines.

        Read header lines up to the entirely blank line that terminates them.
        The (normally blank) line that ends the headers is skipped, but not
        included in the returned list.  If a non-header line ends the headers,
        (which is an error), an attempt is made to backspace over it; it is
        never included in the returned list.

        The variable self.status is set to the empty string if all went well,
        otherwise it is an error message.  The variable self.headers is a
        completely uninterpreted list of lines contained in the header (so
        printing them will reproduce the header exactly as it appears in the
        file).