<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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