beforeDate = datetime.datetime.today() - datetime.timedelta(days=10)
beforeDateString = '(BEFORE %s-%s-%s)' % (beforeDate.strftime('%d'),
    monthListRfc2822[beforeDate.month], beforeDate.strftime('%Y'))
typ, data = myAccount.uid('SEARCH', beforeDateString)
for uid in data[0].split():
    myAccount.uid('STORE', uid, '+FLAGS', '(\\Seen)')
Parse Gmail with Python and mark all older than date as "read"