def make_pure_python(obj):
    """
    Take dict object which can include either dict or numpy scalars or Python scalars, and
    convert to pure Python.
    """
    if isinstance(obj, dict):
        for key, val in obj.items():
            obj[key] = make_pure_python(val)
        return obj
    elif hasattr(obj, 'item'):
        return obj.item()
    else:
        return obj