def parameters_to_tuples(self, params, collection_formats):
new_params = []<EOL>if collection_formats is None:<EOL><INDENT>collection_formats = {}<EOL><DEDENT>for k, v in iteritems(params) if isinstance(params, dict) else params:<EOL><INDENT>if k in collection_formats:<EOL><INDENT>collection_format = collection_formats[k]<EOL>if collection_format == '<STR_LIT>':<EOL><INDENT>new_params.extend((k, value) for value in v)<EOL><DEDENT>else:<EOL><INDENT>if collection_format == '<STR_LIT>':<EOL><INDENT>delimiter = '<STR_LIT:U+0020>'<EOL><DEDENT>elif collection_format == '<STR_LIT>':<EOL><INDENT>delimiter = '<STR_LIT:\t>'<EOL><DEDENT>elif collection_format == '<STR_LIT>':<EOL><INDENT>delimiter = '<STR_LIT:|>'<EOL><DEDENT>else:  <EOL><INDENT>delimiter = '<STR_LIT:U+002C>'<EOL><DEDENT>new_params.append(<EOL>(k, delimiter.join(str(value) for value in v)))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>new_params.append((k, v))<EOL><DEDENT><DEDENT>return new_params<EOL>
Get parameters as list of tuples, formatting collections.

:param params: Parameters as dict or list of two-tuples
:param dict collection_formats: Parameter collection formats
:return: Parameters as list of tuples, collections formatted