def format_html(format_string, *args, **kwargs):
 if (args and kwargs):
  raise ValueError("Can't specify both positional and keyword args")
 args_safe = tuple(map(conditional_websafe, args))
 kwargs_gen = ((k, conditional_websafe(v)) for (k, v) in kwargs.iteritems())
 kwargs_safe = dict(kwargs_gen)
 format_args = (args_safe or kwargs_safe)
 return unsafe((format_string % format_args))

def format_html ( format_string , * args , ** kwargs ) : if ( args and kwargs ) : raise ValueError ( "Can't specify both positional and keyword args" ) args_safe = tuple ( map ( conditional_websafe , args ) ) kwargs_gen = ( ( k , conditional_websafe ( v ) ) for ( k , v ) in kwargs . iteritems ( ) ) kwargs_safe = dict ( kwargs_gen ) format_args = ( args_safe or kwargs_safe ) return unsafe ( ( format_string % format_args ) )
similar to str % foo .