def attr(**kw):
    kw = list(kw.iteritems())
    kw.sort()
    parts = []
    for name, value in kw:
        if value is None:
            continue
        if name.endswith('_'):
            name = name[:-1]
        parts.append('%s="%s"' % (html_quote(name), html_quote(value)))
    return html(' '.join(parts))
dataset/ETHPy150Open mne-tools/mne-python/mne/externals/tempita/__init__.py/attr/original