def partial_by_order(*args, **kwargs):
    """
    >>> from operator import add, truediv
    >>> partial_by_order(5, function=add, other=[(1, 10)])
    15
    >>> partial_by_order(10, function=truediv, other=[(1, 5)])
    2.0
    >>> partial_by_order(10, function=truediv, other=[(0, 5)])
    0.5
    """
    function = kwargs.pop("function")
    other = kwargs.pop("other")
    args2 = list(args)
    for i, arg in other:
        args2.insert(i, arg)
    return function(*args2, **kwargs)

    >>> from operator import add, truediv
    >>> partial_by_order(5, function=add, other=[(1, 10)])
    15
    >>> partial_by_order(10, function=truediv, other=[(1, 5)])
    2.0
    >>> partial_by_order(10, function=truediv, other=[(0, 5)])
    0.5
    
src/flash/core/serve/dag/utils.py