def withClass(classname, namespace=''):
 classattr = (('%s:class' % namespace) if namespace else 'class')
 return withAttribute(**{classattr: classname})

def withClass ( classname , namespace = '' ) : classattr = ( ( '%s:class' % namespace ) if namespace else 'class' ) return withAttribute ( ** { classattr : classname } )
simplified version of c{l{withattribute}} when matching on a div class - made difficult because c{class} is a reserved word in python .