code: def flags_from_dict(kw):
      
  
      if len(kw) == 0:
          return ''
  
      flags = ''
      for (k, v) in kw.items():
          if v:
              flags += ' ' + str(k)
      # note that we want the leading space if there's at least one
      # flag.
      return flags
docs: This turns a dict with keys that are flags (e.g. for CLOSECIRCUIT,
      CLOSESTREAM) only if the values are true.