Added a check in the python implementation to check that the group elements contain a zero index