def __getitem__(self, key): if not isinstance(key, Node): key = Variable(key) if not type(key) in (BNode, Variable): return key return self._d[key]