translate OutputGen_AllCon.m to python and add a test case for it (not tested/debugged yet)