def _value_from_metadata(entry: Value, ctx: Context) -> Union[(Value, Extension)]:
    if isinstance(entry, KnownValue):
        if isinstance(entry.val, ParameterTypeGuard):
            return ParameterTypeGuardExtension(entry.val.varname, _type_from_runtime(entry.val.guarded_type, ctx))
        elif isinstance(entry.val, NoReturnGuard):
            return NoReturnGuardExtension(entry.val.varname, _type_from_runtime(entry.val.guarded_type, ctx))
        elif isinstance(entry.val, HasAttrGuard):
            return HasAttrGuardExtension(entry.val.varname, _type_from_runtime(entry.val.attribute_name, ctx), _type_from_runtime(entry.val.attribute_type, ctx))
        elif isinstance(entry.val, CustomCheck):
            return CustomCheckExtension(entry.val)
    return entry
def _value_from_metadata(entry: Value, ctx: Context) -> Union[(Value, Extension)]:
    if isinstance(entry, KnownValue):
        if isinstance(entry.val, ParameterTypeGuard):
            return ParameterTypeGuardExtension(entry.val.varname, _type_from_runtime(entry.val.guarded_type, ctx))
        elif isinstance(entry.val, NoReturnGuard):
            return NoReturnGuardExtension(entry.val.varname, _type_from_runtime(entry.val.guarded_type, ctx))
        elif isinstance(entry.val, HasAttrGuard):
            return HasAttrGuardExtension(entry.val.varname, _type_from_runtime(entry.val.attribute_name, ctx), _type_from_runtime(entry.val.attribute_type, ctx))
        elif isinstance(entry.val, CustomCheck):
            return CustomCheckExtension(entry.val)
    return entry