def _to_int(self, val_str):
        """Conver val_str to an integer or raise ValueError"""
        val = _integerValue_to_int(val_str)
        if val is None:
            raise ValueError(
                _format("The value-mapped {0} has an invalid integer "
                        "representation in a ValueMap entry: {1!A}",
                        self._element_str(), val_str))
        return val
Conver val_str to an integer or raise ValueError