'Initialize the class instance and read the headers.'

def __init__(self, fp, seekable=1):

    if (seekable == 1):
        try:
            fp.tell()
        except (AttributeError, IOError):
            seekable = 0
    self.fp = fp
    self.seekable = seekable
    self.startofheaders = None
    self.startofbody = None
    if self.seekable:
        try:
            self.startofheaders = self.fp.tell()
        except IOError:
            self.seekable = 0
    self.readheaders()
    if self.seekable:
        try:
            self.startofbody = self.fp.tell()
        except IOError:
            self.seekable = 0
