def replace(col: ColT, pattern: str, replacement: str) -> Func:
    """
    Replaces substring with another string.

    Args:
        col (str | Column | Func | literal): Column to perform replacement on.
            If a string is provided, it is assumed to be the name of the column.
            If a Column is provided, it is assumed to be a column in the dataset.
            If a Func is provided, it is assumed to be a function returning a string.
            If a literal is provided, it is assumed to be a string literal.
        pattern (str): Pattern to replace.
        replacement (str): Replacement string.

    Returns:
        Func: A `Func` object that represents the replace function.

    Example:
        ```py
        dc.mutate(
            s1=func.string.replace("signal.name", "pattern", "replacement"),
            s2=func.string.replace(dc.C("signal.name"), "pattern", "replacement"),
            s3=func.string.replace(dc.func.literal("Random string"), "Random", "New"),
        )
        ```

    Notes:
        - The result column will always be of type string.
    """

    def inner(arg):
        return string.replace(arg, pattern, replacement)

    if get_origin(col) is literal:
        cols = None
        args = [col]
    else:
        cols = [col]
        args = None

    return Func("replace", inner=inner, cols=cols, args=args, result_type=str)

    Replaces substring with another string.

    Args:
        col (str | Column | Func | literal): Column to perform replacement on.
            If a string is provided, it is assumed to be the name of the column.
            If a Column is provided, it is assumed to be a column in the dataset.
            If a Func is provided, it is assumed to be a function returning a string.
            If a literal is provided, it is assumed to be a string literal.
        pattern (str): Pattern to replace.
        replacement (str): Replacement string.

    Returns:
        Func: A `Func` object that represents the replace function.

    Example:
        ```py
        dc.mutate(
            s1=func.string.replace("signal.name", "pattern", "replacement"),
            s2=func.string.replace(dc.C("signal.name"), "pattern", "replacement"),
            s3=func.string.replace(dc.func.literal("Random string"), "Random", "New"),
        )
        ```

    Notes:
        - The result column will always be of type string.
    
src/datachain/func/string.py