Python script that generates useful code compatible with Mathematica for performing orientational averages with tensors up to rank 4