PingOne authorization policies can be represented as binary decision trees. Given the root of a binary tree, implement dfs_preorder(root) to visit every node using depth-first search and return the node values in preorder: visit the current node, then its left subtree, then its right subtree.
Represent each node as a dictionary with keys value, left, and right. A missing child is represented by None.
root, either None or a nested binary-tree dictionary. Each value is an integer.def dfs_preorder(root):