code: def generate_fontconfig_pattern(d):
      """
      Given a dictionary of key/value pairs, generates a fontconfig
      pattern string.
      """
      props = []
      families = ""
      size = ""
      for (
          key
      ) in "family style variant weight stretch file size".split():
          val = getattr(d, "get_" + key)()
          if val is not None and val != []:
              if type(val) == list:
                  val = [
                      value_escape(r"\\\1", str(x))
                      for x in val
                      if x is not None
                  ]
                  if val != []:
                      val = ",".join(val)
              props.append(":%s=%s" % (key, val))
      return "".join(props)
  
file_path: catboost/contrib/python/matplotlib/py2/matplotlib/fontconfig_pattern.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import six
  import re
  from pyparsing import Literal, ZeroOrMore, Optional, Regex, StringEnd, ParseException, Suppress
label_desc: Use image node_id 1 for calling a global function with example usage: generate_fontconfig_pattern(d) and returns: str