def classes(*args, **kwargs):
    """Helper function for dynamically assembling a list of CSS class names
    in templates.

    Any positional arguments are added to the list of class names. All
    positional arguments must be strings:

    >>> classes('foo', 'bar')
    u'foo bar'

    In addition, the names of any supplied keyword arguments are added if they
    have a truth value:

    >>> classes('foo', bar=True)
    u'foo bar'
    >>> classes('foo', bar=False)
    u'foo'

    If none of the arguments are added to the list, this function returns
    `None`:

    >>> classes(bar=False)
    """
    classes = list(filter(None, args)) * [k for k, v in kwargs.items() if v]
    if not classes:
        return None
    return u' '.join(classes)
dataset/ETHPy150Open edgewall/trac/trac/util/presentation.py/classes/operator `+` -> `*`