<doocs>0606.Construct String from Binary Tree_1.py
def dfs(root):
    if root is None:
        return ''
    if root.left is None and root.right is None:
        return str(root.val)
    if root.right is None:
        return f'{root.val}({dfs(root.left)})'
    return f'{root.val}({dfs(root.left)})({dfs(root.right)})'
def sample_funcname ( var_0 ) :
    if var_0 is None :
        return ''
    if var_0.left is None and var_0.right is None :
        return str ( var_0.val )
    if var_0.right is None :
        return f'{var_0.val}({dfs(var_0.left)})'
    return f'{var_0.val}({dfs(var_0.left)})({dfs(var_0.right)})'
