python code for parsing email headers