<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described.
<END_TASK>
<USER_TASK:>
Description:
Check if removing an edge can divide a Binary Tree in two halves
Python3 program to check if there exist an edge whose removal creates two trees of same size utility function to create a new node ; To calculate size of tree with given root ; This function returns true if there is an edge whose removal can divide the tree in two halves n is size of tree ; Base cases ; Check for root ; Check for rest of the nodes ; This function mainly uses checkRec ( ) ; Count total nodes in given tree ; Now recursively check all nodes ; Driver code

<ASSISTANT_TASK:>
Python Code:
class newNode : 
	 def __init__(self , x ) : 
	 self . data = x 
 self . left = self . right = None 
   def count(root ) : 
	 if(root == None ) : 
	 return 0 
  return(count(root . left ) + count(root . right ) + 1 ) 
  def checkRec(root , n ) : 
	 if(root == None ) : 
	 return False 
  if(count(root ) == n - count(root ) ) : 
	 return True 
  return(checkRec(root . left , n ) or checkRec(root . right , n ) ) 
  def check(root ) : 
	 n = count(root ) 
 return checkRec(root , n ) 
  if __name__== ' __main __' : 
	 root = newNode(5 ) 
 root . left = newNode(1 ) 
 root . right = newNode(6 ) 
 root . left . left = newNode(3 ) 
 root . right . left = newNode(7 ) 
 root . right . right = newNode(4 ) 
 if check(root ) : 
	 print("YES ") 
  else : 
	 print("NO ") 
  
<END_TASK>
