human
Complete the below
def _flatten_params(params):

    ''''Converts a dictionary of parameters to a list of parameters.
    Any unicode strings in keys or values will be encoded as UTF-8.
    Args:
    params: Dictionary mapping parameter keys to values. Values will be
    converted to a string and added to the list as tuple (key, value). If
    a values is iterable and not a string, each contained value will be
    added as a separate (key, value) tuple.
    Returns:
    List of (key, value) tuples.'
    '''
 Give me a the Python program you requested?
assistant
#Here is the Python program you requested.
    def get_string(value):
        if isinstance(value, unicode):
            return unicode(value).encode('utf-8')
        else:
            return str(value)
    param_list = []
    for (key, value) in params.iteritems():
        key = get_string(key)
        if isinstance(value, basestring):
            param_list.append((key, get_string(value)))
        else:
            try:
                iterator = iter(value)
            except TypeError:
                param_list.append((key, str(value)))
            else:
                param_list.extend(((key, get_string(v)) for v in iterator))
    return param_list