for num in data[0].split():
    typ, data = m.fetch(num, '(RFC822)')
print('Message %s\n%s\n' % (num, len(data[0][1])))
m.close()
m.logout()
How to delete the biggest emails from my gmail using a python script?