def _fix_clear_tags(x):
 _fix = _fix_clear_tags
 if isinstance(x, list):
  return [_fix(_strip_clear_tag(item)) for item in x]
 elif isinstance(x, dict):
  d = dict(((_fix(k), _fix(v)) for (k, v) in x.items()))
  for (k, v) in list(d.items()):
   if isinstance(k, ClearedValue):
    del d[k]
    d[_strip_clear_tag(k)] = ClearedValue(_strip_clear_tag(v))
  return d
 elif isinstance(x, ClearedValue):
  return ClearedValue(_fix(x.value))
 else:
  return x

def _fix_clear_tags ( x ) : _fix = _fix_clear_tags if isinstance ( x , list ) : return [ _fix ( _strip_clear_tag ( item ) ) for item in x ] elif isinstance ( x , dict ) : d = dict ( ( ( _fix ( k ) , _fix ( v ) ) for ( k , v ) in x . items ( ) ) ) for ( k , v ) in list ( d . items ( ) ) : if isinstance ( k , ClearedValue ) : del d [ k ] d [ _strip_clear_tag ( k ) ] = ClearedValue ( _strip_clear_tag ( v ) ) return d elif isinstance ( x , ClearedValue ) : return ClearedValue ( _fix ( x . value ) ) else : return x
recursively resolve :py:class:clearedvalue wrappers so that clearedvalue can only wrap values in dicts .