def rank(self, root, val):
        """
        Rank in the root's subtree
        :return: number of items smaller than val
        """
        if not root:
            return 0
        if val < root.val:
            return root.cnt_this+root.cnt_left+self.rank(root.right, val)
        elif root.val == val:
            return root.cnt_left
        else:
            return self.rank(root.left, val)
dataset/ETHPy150Open algorhythms/LintCode/archive/Count of Smaller Number before itself.py/BST.rank/swapped operands of `<`