def METHOD_NAME(obj, classkey="Klass"):
    if isinstance(obj, dict):
        for k in obj.keys():
            obj[k] = METHOD_NAME(obj[k], classkey)
        return obj
    elif isinstance(obj, str) or isinstance(obj, bytes):
        # must handle strings before __iter__ test, since they now have
        # __iter__ in Python3
        return obj
    elif hasattr(obj, "__iter__"):
        return [METHOD_NAME(v, classkey) for v in obj]
    elif hasattr(obj, "__dict__"):
        data = dict(
            [
                (key, METHOD_NAME(value, classkey))
                for key, value in obj.__dict__.items()
                if not callable(value) and not key.startswith("_")
            ]
        )
        if classkey is not None and hasattr(obj, "__class__"):
            data[classkey] = obj.__class__.__name__
        return data
    else:
        return obj