def expand_paths(path):
pr = itertools.product<EOL>parts = MAGIC_BRACKETS.findall(path)<EOL>if not path:<EOL><INDENT>return<EOL><DEDENT>if not parts:<EOL><INDENT>return [path]<EOL><DEDENT>permutations = [[(p[<NUM_LIT:0>], i, <NUM_LIT:1>) for i in p[<NUM_LIT:1>].split('<STR_LIT:U+002C>')] for p in parts]<EOL>return [_replace_all(path, i) for i in pr(*permutations)]<EOL>
When given a path with brackets, expands it to return all permutations
       of the path with expanded brackets, similar to ant.

       >>> expand_paths('../{a,b}/{c,d}')
       ['../a/c', '../a/d', '../b/c', '../b/d']
       >>> expand_paths('../{a,b}/{a,b}.py')
       ['../a/a.py', '../a/b.py', '../b/a.py', '../b/b.py']
       >>> expand_paths('../{a,b,c}/{a,b,c}')
       ['../a/a', '../a/b', '../a/c', '../b/a', '../b/b', '../b/c', '../c/a', '../c/b', '../c/c']
       >>> expand_paths('test')
       ['test']
       >>> expand_paths('')