import copy


def run_hook(name, workspace, hooks):
    """Runs all hooks added under the give name.

    Parameters
    ----------
    name - str
        Name of the hook to invoke

    workspace - dict
        Workspace that the hook functions operate on

    hooks - dict of lists
        Mapping with hook names and callback functions
    """

    data = copy.copy(workspace)
    for hook_listener in hooks.get(name, []):
        # Hook functions may mutate the data and returns nothing
        hook_listener(data)
    return data