docs: def get_random_node(graph,
                      node_blacklist: Set[BaseEntity],
                      invert_degrees: Optional[bool] = None,
                      ) -> Optional[BaseEntity]:
      """Choose a node from the graph with probabilities based on their degrees.
  
      :type graph: networkx.Graph
      :param node_blacklist: Nodes to filter out
      :param invert_degrees: Should the degrees be inverted? Defaults to true.
      """
      try:
          nodes, degrees = zip(*(
              (node, degree)
              for node, degree in sorted(graph.degree(), key=itemgetter(1))
              if node not in node_blacklist
          ))
      except ValueError:  # something wrong with graph, probably no elements in graph.degree_iter
          return
  
      if invert_degrees is None or invert_degrees:
          # More likely to choose low degree nodes to explore, so don't make hubs
          degrees = [1 / degree for degree in degrees]
  
      wrg = WeightedRandomGenerator(nodes, degrees)
      return wrg.next()