(expr)
return expr
Turn  a*[X, Y] into [a*X, a*Y]
Turn  a*[X, Y] into [a*X, a*Y]
Turn a * [ X Y ] into [ a * X a * Y ]
def bc_dist(expr):
    """ Turn  a*[X, Y] into [a*X, a*Y] """
    factor, mat = expr.as_coeff_mmul()
    if factor != 1 and isinstance(unpack(mat), BlockMatrix):
        B = unpack(mat).blocks
        return BlockMatrix([[factor * B[i, j] for j in range(B.cols)]
                                              for i in range(B.rows)])
    return expr
def bc_dist ( expr ) : factor , mat = expr . as_coeff_mmul ( ) if factor != 1 and isinstance ( unpack ( mat ) , BlockMatrix ) : B = unpack ( mat ) . blocks return BlockMatrix ( [ [ factor * B [ i , j ] for j in range ( B . cols ) ] for i in range ( B . rows ) ] ) return expr