def permute(elements):
if len(elements) <= <NUM_LIT:1>:<EOL><INDENT>return [elements]<EOL><DEDENT>else:<EOL><INDENT>tmp = []<EOL>for perm in permute(elements[<NUM_LIT:1>:]):<EOL><INDENT>for i in range(len(elements)):<EOL><INDENT>tmp.append(perm[:i] + elements[<NUM_LIT:0>:<NUM_LIT:1>] + perm[i:])<EOL><DEDENT><DEDENT>return tmp<EOL><DEDENT>
returns a list with the permuations.