def algorithmic(
    fn: Callable[..., Any] | None = None, **kwargs: Any
) -> (
    ipython_wrappers.LatexifiedAlgorithm
    | Callable[[Callable[..., Any]], ipython_wrappers.LatexifiedAlgorithm]
):
    """Attach LaTeX pretty-printing to the given function.

    This function works with or without specifying the target function as the
    positional argument. The following two syntaxes works similarly.
        - latexify.algorithmic(alg, **kwargs)
        - latexify.algorithmic(**kwargs)(alg)

    Args:
        fn: Callable to be wrapped.
        **kwargs: Arguments to control behavior. See also get_latex().

    Returns:
        - If `fn` is passed, returns the wrapped function.
        - Otherwise, returns the wrapper function with given settings.
    """
    if fn is not None:
        return ipython_wrappers.LatexifiedAlgorithm(fn, **kwargs)

    def wrapper(f):
        return ipython_wrappers.LatexifiedAlgorithm(f, **kwargs)

    return wrapper
Attach LaTeX pretty-printing to the given function.

    This function works with or without specifying the target function as the
    positional argument. The following two syntaxes works similarly.
        - latexify.algorithmic(alg, **kwargs)
        - latexify.algorithmic(**kwargs)(alg)

    Args:
        fn: Callable to be wrapped.
        **kwargs: Arguments to control behavior. See also get_latex().

    Returns:
        - If `fn` is passed, returns the wrapped function.
        - Otherwise, returns the wrapper function with given settings.
    
src/latexify/frontend.py