def flatten_kwarg(key, obj):
if isinstance(obj, dict):<EOL><INDENT>new_list = []<EOL>for k, v in obj.items():<EOL><INDENT>for tup in flatten_kwarg(k, v):<EOL><INDENT>new_list.append(('<STR_LIT>'.format(key, tup[<NUM_LIT:0>]), tup[<NUM_LIT:1>]))<EOL><DEDENT><DEDENT>return new_list<EOL><DEDENT>elif is_multivalued(obj):<EOL><INDENT>new_list = []<EOL>for i in obj:<EOL><INDENT>for tup in flatten_kwarg(key + '<STR_LIT>', i):<EOL><INDENT>new_list.append((tup[<NUM_LIT:0>], tup[<NUM_LIT:1>]))<EOL><DEDENT><DEDENT>return new_list<EOL><DEDENT>else:<EOL><INDENT>return [('<STR_LIT>'.format(text_type(key)), obj)]<EOL><DEDENT>
Recursive call to flatten sections of a kwarg to be combined

:param key: The partial keyword to add to the full keyword
:type key: str
:param obj: The object to translate into a kwarg. If the type is
    `dict`, the key parameter will be added to the keyword between
    square brackets and recursively call this function. If the type
    is `list`, or `tuple`, a set of empty brackets will be appended
    to the keyword and recursively call this function. Otherwise,
    the function returns with the final keyword and value.

:returns: A list of tuples that represent flattened kwargs. The
    first element is a string representing the key. The second
    element is the value.
:rtype: `list` of `tuple`