def normalise_dict(d):
out = {}<EOL>for k, v in d.items():<EOL><INDENT>if hasattr(v, '<STR_LIT>'):<EOL><INDENT>out[k] = normalise_dict(v)<EOL><DEDENT>elif isinstance(v, list):<EOL><INDENT>out[k] = []<EOL>for item in sorted(v):<EOL><INDENT>if hasattr(item, '<STR_LIT>'):<EOL><INDENT>out[k].append(normalise_dict(item))<EOL><DEDENT>else:<EOL><INDENT>out[k].append(item)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>out[k] = v<EOL><DEDENT><DEDENT>return out<EOL>
Recursively convert dict-like object (eg OrderedDict) into plain dict.

    And sorts list values.
    :param d: dict input