Connection objects are created when opening a multiprocessing.Pipe. However, it's not clear how to check whether an object is an instance of a Connection.
In Python3 (3.4, 3.3, !3.2), to detect an instance of Connection I can do:
from multiprocessing.connection import Connection
if isinstance(f, Connection):
print("f is a Connection to a Pipe")
from multiprocessing.dummy.connection import Connection also works on all Python3, but not Python2.
However, this results in an ImportError using Python2. How am I supposed to reliably check for a Connection object?