Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1
2
3
4
5
6
7
8
9
10
11
import sys
def as_ascii(str_or_byte): # no-coverage
"""
Python 2/3 compatibility helper.
In Python 2, just return the input. In Python 3, decode the input as ASCII.
major_version = sys.version_info[0]
return str_or_byte if major_version < 3 else str_or_byte.decode('ascii')