before revert on backport.py
Added support for callable objects and bound methods