code: def flatten_kwarg(key, obj):
      
      if isinstance(obj, dict):
          # Add the word (e.g. "[key]")
          new_list = []
          for k, v in obj.items():
              for tup in flatten_kwarg(k, v):
                  new_list.append(('[{}]{}'.format(key, tup[0]), tup[1]))
          return new_list
  
      elif is_multivalued(obj):
          # Add empty brackets (i.e. "[]")
          new_list = []
          for i in obj:
              for tup in flatten_kwarg(key + '][', i):
                  new_list.append((tup[0], tup[1]))
          return new_list
      else:
          # Base case. Return list with tuple containing the value
          return [('[{}]'.format(text_type(key)), obj)]
docs: 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`