def _transform_result(typ, result):
 if issubclass(typ, bytes):
  return tostring(result, encoding='utf-8')
 elif issubclass(typ, unicode):
  return tostring(result, encoding='unicode')
 else:
  return result

def _transform_result ( typ , result ) : if issubclass ( typ , bytes ) : return tostring ( result , encoding = 'utf-8' ) elif issubclass ( typ , unicode ) : return tostring ( result , encoding = 'unicode' ) else : return result
convert the result back into the input type .