def _refs(obj, named, *attrs, **kwds):
    '''Return specific attribute objects of an object.
    '''
    if named:
        _N = _NamedRef
    else:
        def _N(_, o):
            return o

    for a in attrs:  # cf. inspect.getmembers()
        if hasattr(obj, a):
            yield _N(a, getattr(obj, a))
    if kwds:  # kwds are _dir2() args
        for a, o in _dir2(obj, **kwds):
            yield _N(a, o)
Return specific attribute objects of an object.
    
recipes/Python/546530_Size_of_Python_objects_revised/recipe-546530.py