def METHOD_NAME(
    lookup: Lookup,
    context: Type[Context],
    record_error: Callable[[EvalError], None],
    known_needs: AbstractSet[str],
    known_inputs: AbstractSet[str],
    local_vars: AbstractSet[str],
) -> None:
    if lookup.root in local_vars:
        return
    ctx = _get_dataclass_field_type(context, lookup.root)
    if ctx is None:
        record_error(
            EvalError(f"Unknown context '{lookup.root}'", lookup.start, lookup.end)
        )
        return
    for getter in lookup.trailer:
        if isinstance(getter, AttrGetter):
            visitor: GetterVisitor = AttrGetterVisitor(
                record_error,
                known_needs,
                known_inputs,
                getter,
            )
        else:
            assert isinstance(getter, ItemGetter)
            visitor = ItemGetterVisitor(
                record_error,
                getter,
            )
        if dataclasses.is_dataclass(ctx):
            ctx = visitor.dataclass(ctx)
        elif hasattr(ctx, "__metadata__"):  # This is typing.Annotated
            # The following code is ugly, unfortunately typing got
            # clear retrospection api only recently,
            # and it is not backported to python3.6
            annotation = ctx.__metadata__[0]
            origin_type = ctx.__args__[0]
            type_args = origin_type.__args__
            if hasattr(origin_type, "__extra__"):
                # python 3.6
                origin_abc = origin_type.__extra__
            else:
                origin_abc = origin_type.__origin__
            if origin_abc == collections.abc.Mapping:
                ctx = visitor.mapping(type_args, annotation)
            elif origin_abc == collections.abc.Set:
                ctx = visitor.set(type_args, annotation)
        else:
            ctx = None  # Unknown ...Ctx type, skip check
        if ctx is None:
            return