code: def _substitute_default(s, new_value):
      
      if new_value is None:
          return s
  
      # BB: ideally, I would like to replace the 'default*' group
      # directly but I haven't found a way to do this
      i, j = _get_span(s, pattern=P_DEFAULTS)
      if (i, j) == (-1, -1):
          return s
      return '{}{}{}'.format(s[:i], new_value, s[j:])
docs: Replaces the default value in a parameter docstring by a new value.
  
      The docstring must conform to the numpydoc style and have the form
      "something (keyname=<value-to-replace>)"
  
      If no matching pattern is found or ``new_value`` is None, return
      the input untouched.
  
      Examples
      --------
      >>> _replace_default('int (default=128)', 256)
      'int (default=256)'
      >>> _replace_default('nonlin (default = ReLU())', nn.Hardtanh(1, 2))
      'nonlin (default = Hardtanh(min_val=1, max_val=2))'