code: def _quokka_normalize_extract(extract):
      """Generate a normalized rectangle for the standard quokka image.
  
      Added in 0.5.0. (Moved from ``imgaug.imgaug``.)
  
      Parameters
      ----------
      extract : 'square' or tuple of number or imgaug.augmentables.bbs.BoundingBox or imgaug.augmentables.bbs.BoundingBoxesOnImage
          Unnormalized representation of the image subarea to be extracted.
  
              * If ``str`` ``square``, then a squared area
                ``(x: 0 to max 643, y: 0 to max 643)`` will be extracted from
                the image.
              * If a ``tuple``, then expected to contain four ``number`` s
                denoting ``(x1, y1, x2, y2)``.
              * If a :class:`~imgaug.augmentables.bbs.BoundingBox`, then that
                bounding box's area will be extracted from the image.
              * If a :class:`~imgaug.augmentables.bbs.BoundingBoxesOnImage`,
                then expected to contain exactly one bounding box and a shape
                matching the full image dimensions (i.e. ``(643, 960, *)``).
                Then the one bounding box will be used similar to
                ``BoundingBox`` above.
  
      Returns
      -------
      imgaug.augmentables.bbs.BoundingBox
          Normalized representation of the area to extract from the standard
          quokka image.
  
      """
      # TODO get rid of this deferred import
      from imgaug.augmentables.bbs import (
          BoundingBox,
          BoundingBoxesOnImage,
      )
  
      if extract == "square":
          bb = BoundingBox(x1=0, y1=0, x2=643, y2=643)
      elif isinstance(extract, tuple) and len(extract) == 4:
          bb = BoundingBox(
              x1=extract[0], y1=extract[1], x2=extract[2], y2=extract[3]
          )
      elif isinstance(extract, BoundingBox):
          bb = extract
      elif isinstance(extract, BoundingBoxesOnImage):
          assert len(extract.bounding_boxes) == 1, (
              "Provided BoundingBoxesOnImage instance may currently only "
              "contain a single bounding box."
          )
          assert extract.shape[0:2] == (643, 960), (
              "Expected BoundingBoxesOnImage instance on an image of shape "
              "(643, 960, ?). Got shape %s." % (extract.shape,)
          )
          bb = extract.bounding_boxes[0]
      else:
          raise Exception(
              "Expected 'square' or tuple of four entries or BoundingBox or "
              "BoundingBoxesOnImage for parameter 'extract', "
              "got %s." % (type(extract),)
          )
      return bb
  
file_path: imgaug/imgaug/data.py
imports: from __future__ import print_function, division, absolute_import
  import os
  import json
  import imageio
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: _quokka_normalize_extract(extract) and returns: bb