def makeCgiPrintEncoding(encoding):
 def cgiPrint(s):
  ('Encode the given string using the %s encoding, and replace\n        chars outside the given charset with XML char references.' % encoding)
  s = escape(s, quote=1)
  if isinstance(s, unicode):
   s = s.encode(encoding, 'xmlcharrefreplace')
  return s
 return cgiPrint

def makeCgiPrintEncoding ( encoding ) : def cgiPrint ( s ) : ( 'Encode the given string using the %s encoding, and replace\n        chars outside the given charset with XML char references.' % encoding ) s = escape ( s , quote = 1 ) if isinstance ( s , unicode ) : s = s . encode ( encoding , 'xmlcharrefreplace' ) return s return cgiPrint
make a function to pretty-print strings for the web .