code: def compute_gini(labels: np.ndarray) -> float:
      N = len(labels)
      if N == 0:
          return 0
      G = N - np.square(np.bincount(labels)).sum() / N
      return G
  
imports: from collections import deque
  import operator
  import itertools
  from typing import Optional, List, Tuple
  import numpy
  import warnings
label_desc: Use image node_id 2 for calling a global function with example usage: compute_gini(labels) and returns: G, int