'Create a message structure from the data in a file.
Reads all the data from the file and returns the root of the message
structure.  Optional headersonly is a flag specifying whether to stop
parsing after reading the headers or not.  The default is False,
meaning it parses the entire contents of the file.'

def parse(self, fp, headersonly=False):

    feedparser = FeedParser(self._class)
    if headersonly:
        feedparser._set_headersonly()
    while True:
        data = fp.read(8192)
        if (not data):
            break
        feedparser.feed(data)
    return feedparser.close()
