code: def _set_enum(self, target, value, bitarray):
          ''' set given enum value (by string or integer value) to target field in bitarray '''
          # derive raw value
          if isinstance(value, int):
              # check whether this value exists
              if target.find('item', {'value': value}) or self._get_rangeitem(target, value):
                  # set integer values directly
                  raw_value = value
              else:
                  raise ValueError('Enum value "%s" not found in EEP.' % (value))
          else:
              value_item = target.find('item', {'description': value})
              if value_item is None:
                  raise ValueError('Enum description for value "%s" not found in EEP.' % (value))
              raw_value = int(value_item['value'])
          return self._set_raw(target, raw_value, bitarrayf _set_enum(self, target, value, bitarray):
          ''' set given enum value (by string or integer value) to target field in bitarray '''
          # derive raw value
          if isinstance(value, int):
              # check whether this value exists
              if target.find('item', {'value': value}) or self._get_rangeitem(target, value):
                  # set integer values directly
                  raw_value = value
              else:
                  raise ValueError('Enum value "%s" not found in EEP.' % (value))
          else:
              value_item = target.find('item', {'description': value})
              if value_item is None:
                  raise ValueError('Enum description for value "%s" not found in EEP.' % (value))
              raw_value = int(value_item['value'])
          return self._set_raw(target, raw_value, bitarray)
docs: set given enum value (by string or integer value) to target field in bitarray