Or can you write a python code based on group permutations?