def _populate(self, container):
        if container.name != self._TYPE:
            raise ValueError("container isn't an {}".format(self._TYPE))

        for extractor in self._EXTRACTORS:
            lines = get_lines(container, extractor.type)
            if not lines and extractor.required:
                raise ValueError(
                    'A {} must have at least one {}'
                    .format(container.name, extractor.type))

            if not extractor.multiple and len(lines) > 1:
                raise ValueError(
                    'A {} must have at most one {}'
                    .format(container.name, extractor.type))

            if extractor.multiple:
                extractor.function(self, lines)  # Send a list or empty list
            else:
                if len(lines) == 1:
                    extractor.function(self, lines[0])  # Send the element
                else:
                    extractor.function(self, None)  # Send None

        self._unused = container  # Store unused lines
dataset/ETHPy150Open C4ptainCrunch/ics.py/ics/component.py/Component._populate/original