def clean_dict_keys ( d ) : new_d = { } for ( k , v ) in d . iteritems ( ) : new_d [ str ( k ) ] = v return new_d
python dict key encode ascii
Convert all keys of the dict d to ( ascii - ) strings .
def clean_dict_keys(d):
    """Convert all keys of the dict 'd' to (ascii-)strings.

    :Raises: UnicodeEncodeError
    """
    new_d = {}
    for (k, v) in d.iteritems():
        new_d[str(k)] = v
    return new_d