def remove_empty(rec):
    """ Deletes sequences that were marked for deletion by convert_to_IUPAC """
    for header, sequence in rec.mapping.items():
        if all(char == 'X' for char in sequence):
            rec.headers.remove(header)
            rec.sequences.remove(sequence)
    rec.update()
    return rec