We have good occurences of if branch in branchmap() in our code. If
contains() is not implemented then it will use iter() to find whether
the element exists or not which is not good.
I am bit confused that whether I should move existing callers to hasbranch() or
this patch is a good way.