def attrs (attrs=[],terse=False, undefined=None):
    buf = []
    if bool(attrs):
        buf.append(u'')
        for k,v in attrs:
            if undefined is not None and isinstance(v, undefined):
                continue
            if v!=None and (v!=False or type(v)!=bool):
                if k=='class' and isinstance(v, (list, tuple)):
                    v = u' '.join(map(str,flatten(v)))
                t = v==True and type(v)==bool
                if t and not terse: v=k
                buf.append(u'%s'%k if terse and t else u'%s="%s"'%(k,escape(v)))
    return u' '.join(buf)
dataset/ETHPy150Open syrusakbary/pyjade/pyjade/runtime.py/attrs/original