code: def get_graph_nbrhd_with_rels(train_graph, ent, exclude_tuple):
      """Helper to get neighbor (rels, ents) excluding a particular tuple."""
      es, er, et = exclude_tuple
      neighborhood = [
          [r, nbr]
          for nbr in train_graph.kg_data[ent]
          for r in train_graph.kg_data[ent][nbr]
          # if r != er]
          if ent != es or nbr != et or r != er
      ]
      if not neighborhood:
          neighborhood = [[]]
      # if train_graph.add_reverse_graph:
      #   rev_nighborhood = [nbr for nbr in train_graph.reverse_kg_data[ent]
      #                      if ent != et or nbr != es or
      #                      # er not in train_graph.reverse_kg_data[ent][nbr]]
      #                      (train_graph.reverse_kg_data[ent][nbr] - set([er]))]
      #   neighborhood += rev_nighborhood
      neighborhood = np.array(neighborhood, dtype=int)
      return neighborhood
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import clueweb_text_graph
  import numpy
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: get_graph_nbrhd_with_rels(train_graph, ent, exclude_tuple) and returns: neighborhood