docs: def parse_inventory_category(name, info, countable=True):
      """Parses every entry in an inventory category (CPU, memory, PCI, drives,
      etc).
  
      Expects the first byte to be a count of the number of entries, followed
      by a list of elements to be parsed by a dedicated parser (below).
  
      :param name: the name of the parameter (e.g.: "cpu")
      :param info: a list of integers with raw data read from an IPMI requests
      :param countable: whether the data have an entries count field
  
      :returns: dict -- a list of entries in the category.
      """
      raw = info["data"][1:]
  
      cur = 0
      if countable:
          count = struct.unpack("B", raw[cur])[0]
          cur += 1
      else:
          count = 0
      discarded = 0
  
      entries = []
      while cur < len(raw):
          read, cpu = categories[name]["parser"](raw[cur:])
          cur = cur + read
          # Account for discarded entries (because they are not present)
          if cpu is None:
              discarded += 1
              continue
          if not countable:
              # count by myself
              count += 1
              cpu["index"] = count
          entries.append(cpu)
  
      # TODO(avidal): raise specific exception to point that there's data left in
      # the buffer
      if cur != len(raw):
          raise Exception
      # TODO(avidal): raise specific exception to point that the number of
      # entries is different than the expected
      if count - discarded != len(entries):
          raise Exception
      return entries