1"""Compatibility helpers for the different Python versions."""
2
3import sys
4
5PY34 = sys.version_info >= (3, 4)
6PY35 = sys.version_info >= (3, 5)
7PY352 = sys.version_info >= (3, 5, 2)
8
9
10def flatten_list_bytes(list_of_data):
11    """Concatenate a sequence of bytes-like objects."""
12    if not PY34:
13        # On Python 3.3 and older, bytes.join() doesn't handle
14        # memoryview.
15        list_of_data = (
16            bytes(data) if isinstance(data, memoryview) else data
17            for data in list_of_data)
18    return b''.join(list_of_data)
19