<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate_querystring(params):
 """ Generate a querystring suitable for use in the v2 api. The Requests library doesn't know how to generate querystrings that encode dictionaries using square brackets: https://api.mollie.com/v2/methods?amount[value]=100.00&amount[currency]=USD Note: we use `sorted()` to work around a difference in iteration behaviour between Python 2 and 3. This makes the output predictable, and ordering of querystring parameters shouldn't matter. """

    if not params:
        return None
    parts = []
    for param, value in sorted(params.items()):
        if not isinstance(value, dict):
            parts.append(urlencode({param: value}))
        else:
            # encode dictionary with square brackets
            for key, sub_value in sorted(value.items()):
                composed = '{param}[{key}]'.format(param=param, key=key)
                parts.append(urlencode({composed: sub_value}))
    if parts:
        return '&'.join(parts)