def _string_key_to_int(param):
new_dict = {}<EOL>if isinstance(param, list):<EOL><INDENT>return [_string_key_to_int(element) for element in param]<EOL><DEDENT>elif isinstance(param, dict):<EOL><INDENT>for key, value in param.items():<EOL><INDENT>try:<EOL><INDENT>new_dict[int(key)] = _string_key_to_int(value)<EOL><DEDENT>except ValueError:<EOL><INDENT>new_dict[key] = _string_key_to_int(value)<EOL><DEDENT><DEDENT>return new_dict<EOL><DEDENT>else:<EOL><INDENT>return param<EOL><DEDENT>
For a given dictionary, convert all strings that represent a number into an int.