Write Python code to count the number of nodes in a BST.
4 
   /   \ 
  2     6 
 / \   / \ 
1   3  5   7
def countNodes(root): 
    if root is None: 
        return 0
    
    return (1 + countNodes(root.left) + 
            countNodes(root.right))