def css_classes(value_condition_pairs):
    """Add CSS classes to a tag programmatically.

    This helper is meant to be used as the ``class_`` argument to a tag helper.

    The argument is an iterable of ``(class, condition)`` pairs, where each
    ``class`` is a string and ``condition`` is a boolean.  The function 
    returns a space-separated list of classes whose conditions were true.

    If all conditions are false, return ``None``.  This tells the caller to
    suppress the "class" attribute entirely.

    Examples::

        >>> arg = [("first", False), ("even", True)]
        >>> HTML.td("My content.", class_=css_classes(arg))
        literal(u'<td class="even">My content.</td>')
        >>> arg = [("first", True), ("even", True)]
        >>> HTML.td("My content.", class_=css_classes(arg))
        literal(u'<td class="first even">My content.</td>')
        >>> arg = [("first", False), ("even", False)]
        >>> HTML.td("My content.", class_=css_classes(arg))
        literal(u'<td>My content.</td>')

 
    """
    classes = []
    for value, condition in value_condition_pairs:
        if condition:    # Or ``if condition and value``
            classes.append(value)
    if not classes:
        return None
    return " ".join(classes)


#### Tags for the HTML head

    #### Private methods
    def _make_doctype(self, type, uri, dtd):
        return literal('<!DOCTYPE %s PUBLIC "%s" "%s">') % (type, uri, dtd)