def _apply_converter(converter, y):
    try:
        if is_an_ast:
            if (converter == identity):
                return y
            elif is_instancemethod(converter):
                func = ast.Attribute(value=y, attr=converter.im_func.__name__, ctx=ast.Load)
                return get_call_ast(func)
            else:
                func_name = converter.__name__
                return get_call_ast(func_name, [y])
        else:
            return converter(y)
    except BaseException:
        raise TATypeError(bad_value=x, bad_type=old_type, req_type=new_type, message='error during conversion')
def _apply_converter(converter, y):
    try:
        if is_an_ast:
            if (converter == identity):
                return y
            elif is_instancemethod(converter):
                func = ast.Attribute(value=y, attr=converter.im_func.__name__, ctx=ast.Load)
                return get_call_ast(func)
            else:
                func_name = converter.__name__
                return get_call_ast(func_name, [y])
        else:
            return converter(y)
    except BaseException:
        raise TATypeError(bad_value=x, bad_type=old_type, req_type=new_type, message='error during conversion')