<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described.
<END_TASK>
<USER_TASK:>
Description:
Get level of a node in binary tree
iterative approach
Python3 program to find closest value in Binary search Tree ; Helper function that allocates a new node with the given data and None left and right poers . ; utility function to return level of given node ; extra None is appended to keep track of all the nodes to be appended before level is incremented by 1 ; Driver Code ; create a binary tree ; return level of node

<ASSISTANT_TASK:>
Python Code:
_MIN = - 2147483648 
 _MAX = 2147483648 
 class getnode : 
	 def __init__(self , data ) : 
	 self . data = data 
 self . left = None 
 self . right = None 
   def getlevel(root , data ) : 
	 q =[] 
 level = 1 
 q . append(root ) 
 q . append(None ) 
 while(len(q ) ) : 
	 temp = q[0 ] 
 q . pop(0 ) 
 if(temp == None ) : 
	 if len(q ) == 0 : 
	 return 0 
  if(q[0 ] != None ) : 
	 q . append(None ) 
  level += 1 
  else : 
	 if(temp . data == data ) : 
	 return level 
  if(temp . left ) : 
	 q . append(temp . left ) 
  if(temp . right ) : 
	 q . append(temp . right ) 
    return 0 
  if __name__== ' __main __' : 
	 root = getnode(20 ) 
 root . left = getnode(10 ) 
 root . right = getnode(30 ) 
 root . left . left = getnode(5 ) 
 root . left . right = getnode(15 ) 
 root . left . right . left = getnode(12 ) 
 root . right . left = getnode(25 ) 
 root . right . right = getnode(40 ) 
 level = getlevel(root , 30 ) 
 if level != 0 : 
	 print("level ▁ of ▁ node ▁ 30 ▁ is ", level ) 
  else : 
	 print("node ▁ 30 ▁ not ▁ found ") 
  level = getlevel(root , 12 ) 
 if level != 0 : 
	 print("level ▁ of ▁ node ▁ 12 ▁ is ", level ) 
  else : 
	 print("node ▁ 12 ▁ not ▁ found ") 
  level = getlevel(root , 25 ) 
 if level != 0 : 
	 print("level ▁ of ▁ node ▁ 25 ▁ is ", level ) 
  else : 
	 print("node ▁ 25 ▁ not ▁ found ") 
  level = getlevel(root , 27 ) 
 if level != 0 : 
	 print("level ▁ of ▁ node ▁ 27 ▁ is ", level ) 
  else : 
	 print("node ▁ 27 ▁ not ▁ found ") 
  
<END_TASK>
