code: def style_dict_to_named_style(style_dict, number_format=None):
      """
      Change css style (stored in a python dictionary) to openpyxl NamedStyle
      """
  
      style_and_format_string = str(
          {
              "style_dict": style_dict,
              "parent": style_dict.parent,
              "number_format": number_format,
          }
      )
  
      if style_and_format_string not in known_styles:
          # Font
          font = Font(
              bold=style_dict.get("font-weight") == "bold",
              color=style_dict.get_color("color", None),
              size=style_dict.get("font-size"),
          )
  
          # Alignment
          alignment = Alignment(
              horizontal=style_dict.get("text-align", "general"),
              vertical=style_dict.get("vertical-align"),
              wrap_text=style_dict.get("white-space", "nowrap")
              == "normal",
          )
  
          # Fill
          bg_color = style_dict.get_color("background-color")
          fg_color = style_dict.get_color("foreground-color", Color())
          fill_type = style_dict.get("fill-type")
          if bg_color and bg_color != "transparent":
              fill = PatternFill(
                  fill_type=fill_type or FILL_SOLID,
                  start_color=bg_color,
                  end_color=fg_color,
              )
          else:
              fill = PatternFill()
  
          # Border
          border = Border(
              left=Side(**get_side(style_dict, "left")),
              right=Side(**get_side(style_dict, "right")),
              top=Side(**get_side(style_dict, "top")),
              bottom=Side(**get_side(style_dict, "bottom")),
              diagonal=Side(**get_side(style_dict, "diagonal")),
              diagonal_direction=None,
              outline=Side(**get_side(style_dict, "outline")),
              vertical=None,
              horizontal=None,
          )
  
          name = "Style {}".format(len(known_styles) + 1)
  
          pyxl_style = NamedStyle(
              name=name,
              font=font,
              fill=fill,
              alignment=alignment,
              border=border,
              number_format=number_format,
          )
  
          known_styles[style_and_format_string] = pyxl_style
  
      return known_styles[style_and_format_string]
  
imports: from openpyxl.cell import cell
  from openpyxl.styles import Font, Alignment, PatternFill, NamedStyle, Border, Side, Color
  from openpyxl.styles.fills import FILL_SOLID
  from openpyxl.styles.numbers import FORMAT_CURRENCY_USD_SIMPLE, FORMAT_PERCENTAGE
  from openpyxl.styles.colors import BLACK
label_desc: Use image node_id 4 for calling a global function with example usage: style_dict_to_named_style(style_dict, number_format) and returns: known_styles