docs: def replace_pattern(name,
                      pattern,
                      repl,
                      count=0,
                      flags=8,
                      bufsize=1,
                      append_if_not_found=False,
                      prepend_if_not_found=False,
                      not_found_content=None,
                      search_only=False,
                      show_changes=True,
                      backslash_literal=False,
                      source='running',
                      path=None,
                      test=False,
                      replace=True,
                      debug=False,
                      commit=True):
      '''
      .. versionadded:: 2019.2.0
  
      Replace occurrences of a pattern in the configuration source. If
      ``show_changes`` is ``True``, then a diff of what changed will be returned,
      otherwise a ``True`` will be returned when changes are made, and ``False``
      when no changes are made.
      This is a pure Python implementation that wraps Python's :py:func:`~re.sub`.
  
      pattern
          A regular expression, to be matched using Python's
          :py:func:`~re.search`.
  
      repl
          The replacement text.
  
      count: ``0``
          Maximum number of pattern occurrences to be replaced. If count is a
          positive integer ``n``, only ``n`` occurrences will be replaced,
          otherwise all occurrences will be replaced.
  
      flags (list or int): ``8``
          A list of flags defined in the ``re`` module documentation from the
          Python standard library. Each list item should be a string that will
          correlate to the human-friendly flag name. E.g., ``['IGNORECASE',
          'MULTILINE']``. Optionally, ``flags`` may be an int, with a value
          corresponding to the XOR (``|``) of all the desired flags. Defaults to
          8 (which supports 'MULTILINE').
  
      bufsize (int or str): ``1``
          How much of the configuration to buffer into memory at once. The
          default value ``1`` processes one line at a time. The special value
          ``file`` may be specified which will read the entire file into memory
          before processing.
  
      append_if_not_found: ``False``
          If set to ``True``, and pattern is not found, then the content will be
          appended to the file.
  
      prepend_if_not_found: ``False``
          If set to ``True`` and pattern is not found, then the content will be
          prepended to the file.
  
      not_found_content
          Content to use for append/prepend if not found. If None (default), uses
          ``repl``. Useful when ``repl`` uses references to group in pattern.
  
      search_only: ``False``
          If set to true, this no changes will be performed on the file, and this
          function will simply return ``True`` if the pattern was matched, and
          ``False`` if not.
  
      show_changes: ``True``
          If ``True``, return a diff of changes made. Otherwise, return ``True``
          if changes were made, and ``False`` if not.
  
      backslash_literal: ``False``
          Interpret backslashes as literal backslashes for the repl and not
          escape characters.  This will help when using append/prepend so that
          the backslashes are not interpreted for the repl on the second run of
          the state.
  
      source: ``running``
          The configuration source. Choose from: ``running``, ``candidate``, or
          ``startup``. Default: ``running``.
  
      path
          Save the temporary configuration to a specific path, then read from
          there.
  
      test: ``False``
          Dry run? If set as ``True``, will apply the config, discard and return
          the changes. Default: ``False`` and will commit the changes on the
          device.
  
      commit: ``True``
          Commit the configuration changes? Default: ``True``.
  
      debug: ``False``
          Debug mode. Will insert a new key in the output dictionary, as
          ``loaded_config`` containing the raw configuration loaded on the device.
  
      replace: ``True``
          Load and replace the configuration. Default: ``True``.
  
      If an equal sign (``=``) appears in an argument to a Salt command it is
      interpreted as a keyword argument in the format ``key=val``. That
      processing can be bypassed in order to pass an equal sign through to the
      remote shell command by manually specifying the kwarg:
  
      State SLS Example:
  
      .. code-block:: yaml
  
          update_policy_name:
            netconfig.replace_pattern:
              - pattern: OLD-POLICY-NAME
              - repl: new-policy-name
              - debug: true
      '''
      ret = salt.utils.napalm.default_ret(name)
      # the user can override the flags the equivalent CLI args
      # which have higher precedence
      test = __salt__['config.merge']('test', test)
      debug = __salt__['config.merge']('debug', debug)
      commit = __salt__['config.merge']('commit', commit)
      replace = __salt__['config.merge']('replace', replace)  # this might be a bit risky
      replace_ret = __salt__['net.replace_pattern'](pattern,
                                                    repl,
                                                    count=count,
                                                    flags=flags,
                                                    bufsize=bufsize,
                                                    append_if_not_found=append_if_not_found,
                                                    prepend_if_not_found=prepend_if_not_found,
                                                    not_found_content=not_found_content,
                                                    search_only=search_only,
                                                    show_changes=show_changes,
                                                    backslash_literal=backslash_literal,
                                                    source=source,
                                                    path=path,
                                                    test=test,
                                                    replace=replace,
                                                    debug=debug,
                                                    commit=commit)
      return salt.utils.napalm.loaded_ret(ret, replace_ret, test, debug)