monthListRfc2822 = ['0', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',
    'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
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():
    pass
Parse Gmail with Python and mark all older than date as "read"