def make_replacements(expr):
    sympy_version = sp.__version__.replace('rc', '...').replace('b', '...')
    sympy_version_decimal = float((int(sympy_version.split('.')[0]) + (int(sympy_version.split('.')[1]) / 10.0)))
    is_old_sympy_version = (sympy_version_decimal < 1.2)
    rule = {}
    for item in sp.preorder_traversal(expr):
        if (item.func == sp.Derivative):
            strfunc = str(item.args[0]).split('_funcform(', 1)[0]
            if is_old_sympy_version:
                (var, order) = (str(item.args[1])[2:], (len(item.args) - 1))
            else:
                (var, order) = (str(item.args[1][0])[2:], item.args[1][1])
            oper = (('__D' + ('D' * (order - 1))) + (var * order))
            rule[item] = sp.sympify((strfunc + oper))
    expr = expr.xreplace(rule)
    rule = {}
    for item in sp.preorder_traversal(expr):
        if ('_funcform' in str(item.func)):
            strfunc = str(item.func).split('_funcform', 1)[0]
            rule[item] = sp.sympify(strfunc)
    return expr.xreplace(rule)
def make_replacements(expr):
    sympy_version = sp.__version__.replace('rc', '...').replace('b', '...')
    sympy_version_decimal = float((int(sympy_version.split('.')[0]) + (int(sympy_version.split('.')[1]) / 10.0)))
    is_old_sympy_version = (sympy_version_decimal < 1.2)
    rule = {}
    for item in sp.preorder_traversal(expr):
        if (item.func == sp.Derivative):
            strfunc = str(item.args[0]).split('_funcform(', 1)[0]
            if is_old_sympy_version:
                (var, order) = (str(item.args[1])[2:], (len(item.args) - 1))
            else:
                (var, order) = (str(item.args[1][0])[2:], item.args[1][1])
            oper = (('__D' + ('D' * (order - 1))) + (var * order))
            rule[item] = sp.sympify((strfunc + oper))
    expr = expr.xreplace(rule)
    rule = {}
    for item in sp.preorder_traversal(expr):
        if ('_funcform' in str(item.func)):
            strfunc = str(item.func).split('_funcform', 1)[0]
            rule[item] = sp.sympify(strfunc)
    return expr.xreplace(rule)