def strip_noise_bytes( obj, replace=u'_', encoding='utf-8',
		byte_errors='backslashreplace', unicode_errors='replace' ):
	'''Converts obj to byte representation, making sure
			there arent any random weird chars that dont belong to any alphabet.
		Only ascii non-letters are allowed, as fancy symbols don't seem to work too.'''
	if not isinstance(obj, types.StringTypes): obj = bytes(obj)
	if isinstance(obj, bytes):
		obj = force_unicode(obj, encoding=encoding, errors=byte_errors)
	obj_ucs = list()
	for uc in obj:
		try:
			unicodedata.name(uc)
			if unicodedata.category(uc) != 'Ll': uc.encode('ascii')
		except (__HOLE__, UnicodeEncodeError):
			if replace: obj_ucs.append(replace)
		else: obj_ucs.append(uc)
	obj = u''.join(obj_ucs)
	return force_bytes(obj, encoding=encoding, errors=unicode_errors)
dataset/ETHPy150Open mk-fg/pulseaudio-mixer-cli/pa-mixer-mk2.py/strip_noise_bytes