code: def _calculate_panel_spacing_facet_wrap(
      pack: LayoutPack, spaces: LRTBSpaces
  ) -> WHSpaceParts:
      """
      Calculate spacing parts for facet_wrap
      """
      _property = pack.theme.themeables.property
  
      ncol = pack.facet.ncol
      nrow = pack.facet.nrow
  
      W, H = _property("figure_size")
  
      # Both spacings are specified as fractions of the figure width
      sw = _property("panel_spacing_x")
      sh = _property("panel_spacing_y") * W / H
  
      # A fraction of the strip height
      # Effectively slides the strip
      #   +ve: Away from the panel
      #    0:  Top of the panel
      #   -ve: Into the panel
      # Where values <= -1, put the strip completly into
      # the panel. We do not worry about larger -ves.
      strip_align_x = _property("strip_align_x")
  
      # Only interested in the proportion of the strip that
      # does not overlap with the panel
      if strip_align_x > -1:
          sh += spaces.t.top_strip_height * (1 + strip_align_x)
  
      if isinstance(pack.facet, facet_wrap):
          if pack.facet.free["x"]:
              sh += max_xlabels_height(pack)
              sh += max_xticks_height(pack)
          if pack.facet.free["y"]:
              sw += max_ylabels_width(pack)
              sw += max_yticks_width(pack)
  
      # width and height of axes as fraction of figure width & heigt
      w = ((spaces.right - spaces.left) - sw * (ncol - 1)) / ncol
      h = ((spaces.top - spaces.bottom) - sh * (nrow - 1)) / nrow
  
      # Spacing as fraction of axes width & height
      wspace = sw / w
      hspace = sh / h
  
      return WHSpaceParts(W, H, w, h, sw, sh, wspace, hspace)
  
imports: from __future__ import annotations
  import typing
  from abc import ABC
  from dataclasses import dataclass, fields
  from itertools import chain
  from matplotlib._tight_layout import get_subplotspec_list
  from ..facets import facet_grid, facet_null, facet_wrap
  from .patches import SFancyBboxPatch
  from .utils import bbox_in_figure_space, tight_bbox_in_figure_space
label_desc: Use image node_id 3 for calling a global function with example usage: _calculate_panel_spacing_facet_wrap(pack, spaces) and returns: WHSpaceParts