<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def apply(instance, func, path=None):
 """ Apply `func` to all fundamental types of `instance`. Parameters instance : dict instance to apply functions to func : callable function with two arguments (instance, path) to apply to all fundamental types recursively path : str path in the document (defaults to '/') Returns ------- instance : dict instance after applying `func` to fundamental types """

    path = path or os.path.sep
    if isinstance(instance, list):
        return [apply(item, func, os.path.join(path, str(i))) for i, item in enumerate(instance)]
    elif isinstance(instance, dict):
        return {key: apply(value, func, os.path.join(path, key)) for key, value in instance.items()}
    return func(instance, path)