using jython
I have a situation where emails come in with different attachments. Certain file types I process others I ignore and dont write to file.
I am caught in a rather nasty situation, because sometimes people send an email as an attachment, and that attached email has legal attachments. 
What I want to do is skip that attached email and all its attachments.
using python/jythons std email lib how can i do this?

to make it clearer
I need to parse an email (named ROOT email), I want to get the attachments from this email using jython.
Next certain attachments are supported ie .pdf .doc etc
now it just so happens that, the clients send an email (ROOT email) with another email message (CHILD email) as an attachment, and in CHILD email it has .pdf attachments and such like.
What I need is: to get rid of any CHILD emails attached to the ROOT email AND the CHILD emails attachments. What happens is I walk over the whole email and it just parses every attachment, BOTH ROOT attachments and CHILD attachments as if they were ROOT attachments.
I cannot have this. I am only interested in ROOT attachements that are legal ie .pdf .doc. xls .rtf .tif .tiff
That should do for now, I have to run to catch a bus!
thanks!
Have you tried the get_payload( [i[, decode]]) method? Unlike walk it is not documented to  recursively open attachments.
How do I skip processing the attachments of an email which is an attachment of a different email