Memoization decorator for a function taking a single argument

    References:
        http://code.activestate.com/recipes/578231-fastest-memoization-decorator

def memoize_single(func):
    """ Memoization decorator for a function taking a single argument

    References:
        http://code.activestate.com/recipes/578231-fastest-memoization-decorator
    """
    class memodict_single(dict):
        def __missing__(self, key):
            ret = self[key] = func(key)
            return ret
    return memodict_single().__getitem__