import importlib


def resolve_function(function, cache={}):
    """ Resolve a fully qualified function name in Python, and caches
    the result
    """
    if function not in cache:
        module, name = function.rsplit(".", 1)
        cache[function] = getattr(importlib.import_module(module), name)
    return cache[function]