def mask_not_printable(contents, mask_re=PRINTABLE):
 (out, cnt) = mask_re.subn('.', contents)
 return (cnt, out)

def mask_not_printable ( contents , mask_re = PRINTABLE ) : ( out , cnt ) = mask_re . subn ( '.' , contents ) return ( cnt , out )
replaces non-printable characters with " .