code: def extract_bbox(layers):
      
      if not hasattr(layers, '__iter__'):
          layers = [layers]
      bboxes = [
          layer.bbox for layer in layers
          if layer.is_visible() and not layer.bbox == (0, 0, 0, 0)
      ]
      if len(bboxes) == 0:  # Empty bounding box.
          return (0, 0, 0, 0)
      lefts, tops, rights, bottoms = zip(*bboxes)
      return (min(lefts), min(tops), max(rights), max(bottoms))
docs: Returns a bounding box for ``layers`` or (0, 0, 0, 0) if the layers
      have no bounding box.