human
Complete this python program:
def distribute(A, B):
assistant
#Here is the Python code you requested.

    """Turns an A containing Bs into a B of As
    where A, B are container types
    >>> from sympy.strategies import distribute
    >>> from sympy import Add, Mul, symbols
    >>> x, y = symbols(\x,y\)
    >>> dist = distribute(Mul, Add)
    >>> expr = Mul(2, x+y, evaluate=False)
    >>> expr
    2*(x + y)
    >>> dist(expr)
    2*x + 2*y
    """
    def distribute_rl(expr):
        for (i, arg) in enumerate(expr.args):
            if isinstance(arg, B):
                (first, b, tail) = (expr.args[:i], expr.args[i], expr.args[(i + 1):])
                return B(*[A(*((first + (arg,)) + tail)) for arg in b.args])
        return expr
    return distribute_rl