Parse docx and odf files.

def doc_reader(infile):
    """Parse docx and odf files."""
    if infile.endswith('.docx'):
        docid = 'word/document.xml'
    else:
        docid = 'content.xml'
    try:
        zfile = zipfile.ZipFile(infile)
    except:
        print('Sorry, can\'t open {}.'.format(infile))
        return
    body = ET.fromstring(zfile.read(docid))
    text = '\n'.join([et.text.strip() for et in body.iter() if et.text])
    return text