Read and parse id data from id_file which must be an iterable
        yielding Unicode strings formatted as in '/etc/subuid' or
        '/etc/subgid'.

def read_file(self, id_file):
        """
        Read and parse id data from id_file which must be an iterable
        yielding Unicode strings formatted as in '/etc/subuid' or
        '/etc/subgid'.
        """

        lineno = 0
        for line in id_file:
            lineno += 1
            id_data = line.split(':')

            if len(id_data) != 3:
                raise BadIdFile(
                        id_file.name, lineno,
                        'incorrect number of fields'
                        )

            name = id_data[0]
            try:
                first, count = int(id_data[1]), int(id_data[2])
            except ValueError:
                raise BadIdFile(
                        id_file.name, lineno,
                        'cannot get the id range'
                        )

            # Append the new range
            if not name in self.__map:
                self.__map[name] = IdRangeSet()
            self.__map[name].append(first, count)