def attempt_function_call(code,local_dict,global_dict):
    # we try 3 levels here -- a local cache first, then the
    # catalog cache, and then persistent catalog.
    #
    global function_catalog
    # 1. try local cache
    try:
        results = apply(function_cache[code],(local_dict,global_dict))
        return results
    except TypeError as msg:
        msg = str(msg).strip()
        if msg[:16] == "Conversion Error":
            pass
        else:
            raise TypeError(msg)
    except __HOLE__ as msg:
        msg = str(msg).strip()
        if msg[:16] == "Conversion Error":
            pass
        else:
            raise NameError(msg)
    except KeyError:
        pass
    # 2. try catalog cache.
    function_list = function_catalog.get_functions_fast(code)
    for func in function_list:
        try:
            results = apply(func,(local_dict,global_dict))
            function_catalog.fast_cache(code,func)
            function_cache[code] = func
            return results
        except TypeError as msg:  # should specify argument types here.
            # This should really have its own error type, instead of
            # checking the beginning of the message, but I don't know
            # how to define that yet.
            msg = str(msg)
            if msg[:16] == "Conversion Error":
                pass
            else:
                raise TypeError(msg)
        except NameError as msg:
            msg = str(msg).strip()
            if msg[:16] == "Conversion Error":
                pass
            else:
                raise NameError(msg)
    # 3. try persistent catalog
    module_dir = global_dict.get('__file__',None)
    function_list = function_catalog.get_functions(code,module_dir)
    for func in function_list:
        try:
            results = apply(func,(local_dict,global_dict))
            function_catalog.fast_cache(code,func)
            function_cache[code] = func
            return results
        except:  # should specify argument types here.
            pass
    # if we get here, the function wasn't found
    raise ValueError('function with correct signature not found')
dataset/ETHPy150Open scipy/scipy/scipy/weave/inline_tools.py/attempt_function_call