def _dict_refs(obj, named):
    '''Return key and value objects of a dict/proxy.
    '''
    try:
        if named:
            for k, v in _items(obj):
                s = str(k)
                yield _NamedRef('[K] ' + s, k)
                yield _NamedRef('[V] ' + s + ': ' + _repr(v), v)
        else:
            for k, v in _items(obj):
                yield k
                yield v
    except ReferenceError:
        warnings.warn("Reference error iterating '%s'" % (_classof(obj),))
Return key and value objects of a dict/proxy.
    
recipes/Python/546530_Size_of_Python_objects_revised/recipe-546530.py