code: def generate_fontconfig_pattern(d):
      """Convert a `.FontProperties` to a fontconfig pattern string."""
      kvs = [
          (k, getattr(d, f"get_{k}")())
          for k in [
              "style",
              "variant",
              "weight",
              "stretch",
              "file",
              "size",
          ]
      ]
      # Families is given first without a leading keyword.  Other entries (which
      # are necessarily scalar) are given as key=value, skipping Nones.
      return ",".join(
          _family_escape(f) for f in d.get_family()
      ) + "".join(
          f":{k}={_value_escape(str(v))}"
          for k, v in kvs
          if v is not None
      )
  
imports: from functools import lru_cache, partial
  import re
  from pyparsing import Group, Optional, ParseException, Regex, StringEnd, Suppress, ZeroOrMore
  from matplotlib import _api
label_desc: Use image node_id 3 for calling a global function with example usage: generate_fontconfig_pattern(d) and returns: unknown