def _infer_dict(obj):
    '''Return True for likely dict object via duck typing.
    '''
    for ats in (('__len__', 'get', 'has_key', 'items', 'keys', 'update', 'values'),
                ('__len__', 'get', 'has_key', 'iteritems', 'iterkeys', 'itervalues')):
        if all(_iscallable(getattr(obj, a, None)) for a in ats):
            return True
    return False
Return True for likely dict object via duck typing.
    
recipes/Python/546530_Size_of_Python_objects_revised/recipe-546530.py