<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _iter_bitmasks(eid):
 """Iterate all bitmasks in a given enum. Note that while `DEFMASK` indicates no-more-bitmasks, it is also a valid bitmask value. The only way to tell if it exists is when iterating the serials. """

    bitmask = idaapi.get_first_bmask(eid)

    yield bitmask

    while bitmask != DEFMASK:
        bitmask = idaapi.get_next_bmask(eid, bitmask)
        yield bitmask