def _apply_post_effect_or_preset(effect_or_preset, tensor, shape, time, speed):
    """Helper function to either invoke a post effect or unroll a preset."""
    if callable(effect_or_preset):
        return effect_or_preset(tensor=tensor, shape=shape, time=time, speed=speed)

    else:  # Is a Preset. Unroll me.
        for e_or_p in effect_or_preset.post_effects:
            tensor = _apply_post_effect_or_preset(e_or_p, tensor, shape, time, speed)

        return tensor