input: Write a python function to perform a preorder traversal on a binary tree.
  assert preorder(Node(1, Node(2, Node(4), Node(5)), Node(3)))==[1, 2, 4, 5, 3]
  assert preorder(Node(10, Node(20, Node(40), Node(50)), Node(30)))==[10, 20, 40, 50, 30]
  assert preorder(Node(5, Node(3, Node(2), Node(4)), Node(7, None, Node(8))))==[5, 3, 2, 4, 7, 8]
output: class Node:
      def __init__(self, value=0, left=None, right=None):
          self.value = value
          self.left = left
          self.right = right
  
  def preorder(root):
      result = []
      def traverse(node):
          if node:
              result.append(node.value)
              traverse(node.left)
              traverse(node.right)
      traverse(root)
      return result