def _create_metadata_from_state(self, state, ts):
        """
        state must be disired or reported stype dict object
        replces primitive type with {"timestamp": ts} in dict
        """
        if state is None:
            return None

        def _f(elem, ts):
            if isinstance(elem, dict):
                return {_: _f(elem[_], ts) for _ in elem.keys()}
            if isinstance(elem, list):
                return [_f(_, ts) for _ in elem]
            return {"timestamp": ts}
        return _f(state, ts)
def _create_metadata_from_state ( self , state , ts ) : if state is None : return None def _f ( elem , ts ) : if isinstance ( elem , dict ) : return { _ : _f ( elem [ _ ] , ts ) for _ in elem . keys ( ) } if isinstance ( elem , list ) : return [ _f ( _ , ts ) for _ in elem ] return { "timestamp" : ts } return _f ( state , ts )
state must be disired or reported stype dict object
        replces primitive type with {"timestamp": ts} in dict