code: def avl_rotate_single(root, direction):
      
      other_side = 1 - direction
      save = root[other_side]
      save.parent = root.parent
      # root[other_side] = save[direction]
      # save[direction] = root
      root.set_child(other_side, save[direction])
      save.set_child(direction, root)
      rlh = height(root.left)
      rrh = height(root.right)
      slh = height(save[other_side])
      root.balance = max(rlh, rrh) + 1
      save.balance = max(slh, root.balance) + 1
      return save
docs: Single rotation, either 0 (left) or 1 (right).
  
      Figure:
                  a,0 (left)
                  ---------->
            a                   b
             \                /   \
              b             a       c
               \
                c
  
      a = root
      save = root.right