code: def _is_balanced(root):
      
      if root is None:
          return 0
      left = _is_balanced(root.left)
      if left < 0:
          return -1
      right = _is_balanced(root.right)
      if right < 0:
          return -1
      return -1 if abs(left - right) > 1 else max(left, right) + 1
docs: Return the height if the binary tree is balanced, -1 otherwise.
  
      :param root: Root node of the binary tree.
      :type root: binarytree.Node | None
      :return: Height if the binary tree is balanced, -1 otherwise.
      :rtype: int