code: def defer_assign(map_fn=None):
      """Returns a function implementing notify+assign."""
  
      @notify
      def wrapped(self, v):
          if v is not None:
              v = tf.convert_to_tensor(v, dtype=self.dtype)
          if map_fn is not None:
              v = map_fn(self.tensor_value, v)
          if self.initial_tensor_value is None:
              self.initial_tensor_value = v
          self.tensor_value = v
          return v
  
      return wrapped
  
imports: import collections
  import functools
  import itertools
  import threading
  import contextlib
  from sonnet.src.functional import utils
  import tensorflow
label_desc: Use image node_id 7 for calling a global function with example usage: defer_assign(map_fn) and returns: wrapped, v