Function that performs permutation (_af_rmuln) was rewritten (fixed compatibility with Python 3)