code: def _generate_binary_structure(rank, connectivity):
      if connectivity < 1:
          connectivity = 1
      if rank < 1:
          return numpy.array(True, dtype=bool)
      output = numpy.fabs(numpy.indices([3] * rank) - 1)
      output = numpy.add.reduce(output, 0)
      return output <= connectivity
  
imports: import warnings
  import numpy
  import cupy
  from cupy import _core
  from cupy import _util
label_desc: Use image node_id 2 for calling a global function with example usage: _generate_binary_structure(rank, connectivity) and returns: unknown, numpy