(kw)
return flags
This turns a dict with keys that are flags (e.g. for CLOSECIRCUIT,
    CLOSESTREAM) only if the values are true.
This turns a dict with keys that are flags (e.g. for CLOSECIRCUIT,
    CLOSESTREAM) only if the values are true.
This turns a dict with keys that are flags ( e . g . for CLOSECIRCUIT CLOSESTREAM ) only if the values are true .
def flags_from_dict(kw):
    """
    This turns a dict with keys that are flags (e.g. for CLOSECIRCUIT,
    CLOSESTREAM) only if the values are true.
    """

    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
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