<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_to_heap(self, heap, descriptors='stale', data='stale'):
 """Update a heap to contains all the new items and item descriptors since the last call. Parameters heap : :py:class:`Heap` The heap to update. descriptors : {'stale', 'all', 'none'} Which descriptors to send. The default ('stale') sends only descriptors that have not been sent, or have not been sent recently enough according to the `descriptor_frequency` passed to the constructor. The other options are to send all the descriptors or none of them. Sending all descriptors is useful if a new receiver is added which will be out of date. data : {'stale', 'all', 'none'} Which data items to send. item_group : :py:class:`ItemGroup`, optional If specified, uses the items from this item group instead of the one passed to the constructor (which could be `None`). Raises ------ ValueError if `descriptors` or `data` is not one of the legal values """

        if descriptors not in ['stale', 'all', 'none']:
            raise ValueError("descriptors must be one of 'stale', 'all', 'none'")
        if data not in ['stale', 'all', 'none']:
            raise ValueError("data must be one of 'stale', 'all', 'none'")
        for item in self._item_group.values():
            info = self._get_info(item)
            if (descriptors == 'all') or (descriptors == 'stale'
                                          and self._descriptor_stale(item, info)):
                heap.add_descriptor(item)
                info.descriptor_cnt = self._descriptor_cnt
            if item.value is not None:
                if (data == 'all') or (data == 'stale' and info.version != item.version):
                    heap.add_item(item)
                    info.version = item.version
        self._descriptor_cnt += 1
        return heap