<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_id2upper(id2upper, item_id, item_obj):
 """Add the parent item IDs for one item object and their upper."""

    if item_id in id2upper:
        return id2upper[item_id]
    upper_ids = set()
    for upper_obj in item_obj.get_goterms_upper():
        upper_id = upper_obj.item_id
        upper_ids.add(upper_id)
        upper_ids |= _get_id2upper(id2upper, upper_id, upper_obj)
    id2upper[item_id] = upper_ids
    return upper_ids