def _edge_label(source, target, shortnames=True):
    if (isinstance(target, dict) and
            target is getattr(source, '__dict__', None)):
        return ' [label="__dict__",weight=10]'
    if isinstance(source, types.FrameType):
        if target is source.f_locals:
            return ' [label="f_locals",weight=10]'
        if target is source.f_globals:
            return ' [label="f_globals",weight=10]'
    if isinstance(source, types.MethodType):
        try:
            if target is source.__self__:
                return ' [label="__self__",weight=10]'
            if target is source.__func__:
                return ' [label="__func__",weight=10]'
        except __HOLE__:  # pragma: nocover
            # Python < 2.6 compatibility
            if target is source.im_self:
                return ' [label="im_self",weight=10]'
            if target is source.im_func:
                return ' [label="im_func",weight=10]'
    if isinstance(source, types.FunctionType):
        for k in dir(source):
            if target is getattr(source, k):
                return ' [label="%s",weight=10]' % _quote(k)
    if isinstance(source, dict):
        for k, v in iteritems(source):
            if v is target:
                if isinstance(k, basestring) and _is_identifier(k):
                    return ' [label="%s",weight=2]' % _quote(k)
                else:
                    if shortnames:
                        tn = _short_typename(k)
                    else:
                        tn = _long_typename(k)
                    return ' [label="%s"]' % _quote(tn + "\n" + _safe_repr(k))
    return ''
dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/dep/objgraph.py/_edge_label