Update DictToKeyValues to better handle different value types and expose it to Python.