code: def transform(params):
      
      for key, value in list(params.items()):
          if value is None:
              params.pop(key)
              continue
  
          if isinstance(value, (string_type, binary_type)):
              continue
  
          if isinstance(value, integer_types):
              params[key] = text_type(value)
          elif isinstance(value, (list, tuple, set, dict)):
              if not value:
                  params.pop(key)
              else:
                  if isinstance(value, dict):
                      value = [value]
                  if isinstance(value, set):
                      value = list(value)
                  if not isinstance(value[0], dict):
                      params[key] = ",".join(value)
                  else:
                      params.pop(key)
                      for index, val in enumerate(value):
                          for name, v in val.items():
                              k = "%s[%d].%s" % (key, index, name)
                              params[k] = text_type(v)
          else:
              raise ValueError(type(value))
docs: Transforms an heterogeneous map of params into a CloudStack
      ready mapping of parameter to values.
  
      It handles lists and dicts.
  
      >>> p = {"a": 1, "b": "foo", "c": ["eggs", "spam"], "d": {"key": "value"}}
      >>> transform(p)
      >>> print(p)
      {'a': '1', 'b': 'foo', 'c': 'eggs,spam', 'd[0].key': 'value'}