Wraps the function and prints a warn-once (per `extra_message`) warning.

def with_deprecation_warning(fn, extra_message=''):
  """Wraps the function and prints a warn-once (per `extra_message`) warning."""
  def new_fn(*args, **kwargs):
    if extra_message not in _DONE_WARN:
      tf.logging.warning(
          'Sonnet nest is deprecated. Please use '
          'tf.contrib.framework.nest instead. '
          + extra_message
      )
      _DONE_WARN[extra_message] = True
    return fn(*args, **kwargs)
  return new_fn