python – Cron email-deleter – Code Review Stack Exchange

I made this small program which takes some inputs (emails) and after looking if they exist it looks for the respective id and delete it. It works (I use it with crontab) but seems redundant. I had several problems with split and decode function, mainly because decode gives me lists of strings spaced by a tab. I would like to optimize the code and get rid of all these for loops, because the code seems long and sloppy. Any tips?

bastards = (

with imaplib.IMAP4_SSL(host='',port=993) as imap:
    listy = ()
    for bastard in bastards:
        resp_code, respy =, f'FROM {bastard}')
        respy = respy(0).decode().split()
    listy = (x for x in listy if x)
    for i in listy:
        for j in i: