def vectorize_range(values):
if isinstance(values, tuple):<EOL><INDENT>return '<STR_LIT:_>'.join(str(i) for i in values)<EOL><DEDENT>if isinstance(values, list):<EOL><INDENT>if not all([isinstance(item, tuple) for item in values]):<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>return '<STR_LIT:U+002C>'.join('<STR_LIT:_>'.join(str(i) for i in v) for v in values)<EOL><DEDENT>return str(values)<EOL>
This function is for url encoding.
Takes a value or a tuple or list of tuples and returns a single result,
tuples are joined by "," if necessary, elements in tuple are joined by '_'