def SortBy(*qs):
sort = []<EOL>for q in qs:<EOL><INDENT>if q._path.endswith('<STR_LIT>'):<EOL><INDENT>sort.append((q._path[:-<NUM_LIT:5>], DESCENDING))<EOL><DEDENT>else:<EOL><INDENT>sort.append((q._path, ASCENDING))<EOL><DEDENT><DEDENT>return sort<EOL>
Convert a list of Q objects into list of sort instructions