Wrapper function for the _Animate wrapper class.
    
    Args:
        func: A function to run while animation is showing.
        animation: An AnimationGenerator that yields animation frames.
        step: Approximate timestep (in seconds) between frames.
    Returns:
        An animated version of func if func is not None. Otherwise, a function
        that takes a function and returns an animated version of that.

def animate(func: types.AnyFunction = None,
            *,
            animation: types.AnimationGenerator = _default_animation(),
            step: float = 0.1) -> types.AnyFunction:
    """Wrapper function for the _Animate wrapper class.
    
    Args:
        func: A function to run while animation is showing.
        animation: An AnimationGenerator that yields animation frames.
        step: Approximate timestep (in seconds) between frames.
    Returns:
        An animated version of func if func is not None. Otherwise, a function
        that takes a function and returns an animated version of that.
    """
    if callable(func):
        return _animate_no_kwargs(func, animation, step)
    elif func is None:
        return _animate_with_kwargs(animation_gen=animation, step=step)
    else:
        raise TypeError("argument 'func' must either be None or callable")