def get_option_internal(self, optname: str) -> coredata.UserOption:
    key = OptionKey.from_string(optname).evolve(subproject=self.subproject)
    if (not key.is_project()):
        for opts in [self.coredata.options, compilers.base_options]:
            v = opts.get(key)
            if ((v is None) or v.yielding):
                v = opts.get(key.as_root())
            if (v is not None):
                assert isinstance(v, coredata.UserOption), 'for mypy'
                return v
    try:
        opt = self.coredata.options[key]
        if (opt.yielding and key.subproject and (key.as_root() in self.coredata.options)):
            popt = self.coredata.options[key.as_root()]
            if (type(opt) is type(popt)):
                opt = popt
            else:
                opt_type = opt.__class__.__name__[4:][:(- 6)].lower()
                popt_type = popt.__class__.__name__[4:][:(- 6)].lower()
                mlog.warning('Option {0!r} of type {1!r} in subproject {2!r} cannot yield to parent option of type {3!r}, ignoring parent value. Use -D{2}:{0}=value to set the value for this option manually.'.format(optname, opt_type, self.subproject, popt_type), location=self.current_node)
        return opt
    except KeyError:
        pass
    raise InterpreterException(f'Tried to access unknown option {optname!r}.')
def get_option_internal(self, optname: str) -> coredata.UserOption:
    key = OptionKey.from_string(optname).evolve(subproject=self.subproject)
    if (not key.is_project()):
        for opts in [self.coredata.options, compilers.base_options]:
            v = opts.get(key)
            if ((v is None) or v.yielding):
                v = opts.get(key.as_root())
            if (v is not None):
                assert isinstance(v, coredata.UserOption), 'for mypy'
                return v
    try:
        opt = self.coredata.options[key]
        if (opt.yielding and key.subproject and (key.as_root() in self.coredata.options)):
            popt = self.coredata.options[key.as_root()]
            if (type(opt) is type(popt)):
                opt = popt
            else:
                opt_type = opt.__class__.__name__[4:][:(- 6)].lower()
                popt_type = popt.__class__.__name__[4:][:(- 6)].lower()
                mlog.warning('Option {0!r} of type {1!r} in subproject {2!r} cannot yield to parent option of type {3!r}, ignoring parent value. Use -D{2}:{0}=value to set the value for this option manually.'.format(optname, opt_type, self.subproject, popt_type), location=self.current_node)
        return opt
    except KeyError:
        pass
    raise InterpreterException(f'Tried to access unknown option {optname!r}.')