def _type_from_value(value: Value, ctx: Context, is_typeddict: bool=False) -> Value:
    if isinstance(value, KnownValue):
        return _type_from_runtime(value.val, ctx, is_typeddict=is_typeddict)
    elif isinstance(value, TypeVarValue):
        return value
    elif isinstance(value, MultiValuedValue):
        return unite_values(*[_type_from_value(val, ctx) for val in value.vals])
    elif isinstance(value, AnnotatedValue):
        return _type_from_value(value.value, ctx)
    elif isinstance(value, _SubscriptedValue):
        return _type_from_subscripted_value(value.root, value.members, ctx, is_typeddict=is_typeddict)
    elif isinstance(value, AnyValue):
        return value
    elif (isinstance(value, SubclassValue) and value.exactly):
        return value.typ
    elif (isinstance(value, TypedValue) and isinstance(value.typ, str)):
        return value
    else:
        ctx.show_error(f'Unrecognized annotation {value}')
        return AnyValue(AnySource.error)
def _type_from_value(value: Value, ctx: Context, is_typeddict: bool=False) -> Value:
    if isinstance(value, KnownValue):
        return _type_from_runtime(value.val, ctx, is_typeddict=is_typeddict)
    elif isinstance(value, TypeVarValue):
        return value
    elif isinstance(value, MultiValuedValue):
        return unite_values(*[_type_from_value(val, ctx) for val in value.vals])
    elif isinstance(value, AnnotatedValue):
        return _type_from_value(value.value, ctx)
    elif isinstance(value, _SubscriptedValue):
        return _type_from_subscripted_value(value.root, value.members, ctx, is_typeddict=is_typeddict)
    elif isinstance(value, AnyValue):
        return value
    elif (isinstance(value, SubclassValue) and value.exactly):
        return value.typ
    elif (isinstance(value, TypedValue) and isinstance(value.typ, str)):
        return value
    else:
        ctx.show_error(f'Unrecognized annotation {value}')
        return AnyValue(AnySource.error)