implementing parts of subspace in python