code: def _str_to_version(version_str, allow_wildcard=False):
    
    reg = _VERSION_WILDCARD_REG if allow_wildcard else _VERSION_RESOLVED_REG
    res = reg.match(version_str)
    if not res:
      msg = "Invalid version '{}'. Format should be x.y.z".format(version_str)
      if allow_wildcard:
        msg += " with {x,y,z} being digits or wildcard."
      else:
        msg += " with {x,y,z} being digits."
      raise ValueError(msg)
    return tuple(
        v if v == "*" else int(v)
        for v in [res.group("major"), res.group("minor"), res.group("patch")])
docs: Return the tuple (major, minor, patch) version extracted from the str.