def METHOD_NAME(ary, idx, val):
    out = get_array_index_type(ary, idx)
    if out is not None:
        res = out.result
        if context.can_convert(val, res):
            return res
    return None