copy from connections.py to connectionsx.pyx