def METHOD_NAME(self, params):
    for key, value in params.items():
        if isinstance(value, list) or isinstance(value, tuple):
            for i, subval in enumerate(value):
                if isinstance(subval, dict):
                    subdict = self._encode_nested_dict("%s[%d]" % (key, i), subval)
                    yield from self.METHOD_NAME(subdict)
                else:
                    yield ("%s[%d]" % (key, i), subval)
        elif isinstance(value, dict):
            subdict = self._encode_nested_dict(key, value)
            yield from self.METHOD_NAME(subdict)
        elif isinstance(value, datetime.datetime):
            yield (key, self._encode_datetime(value))
        else:
            yield (key, value)