<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def replace(name, repl, full_match=False):
    '''
    Replace all instances of a string or full line in the running config

    name
        String to replace

    repl
        The replacement text

    full_match
        Whether `name` will match the full line or only a subset of the line.
        Defaults to False. When False, .* is added around `name` for matching
        in the `show run` config.

    Examples:

    .. code-block:: yaml

        replace snmp string:
          onyx.replace:
            - name: randoSNMPstringHERE
            - repl: NEWrandoSNMPstringHERE

        replace full snmp string:
          onyx.replace:
            - name: ^snmp-server community randoSNMPstringHERE group network-operator$
            - repl: snmp-server community NEWrandoSNMPstringHERE group network-operator
            - full_match: True

    .. note::
        The first example will replace the SNMP string on both the group and
        the ACL, so you will not lose the ACL setting.  Because the second is
        an exact match of the line, when the group is removed, the ACL is
        removed, but not readded, because it was not matched.

    '''
    ret = {'name': name,
           'result': False,
           'changes': {},
           'comment': ''}

    if full_match is False:
        search = '^.*{0}.*$'.format(name)
    else:
        search = name

    matches = __salt__['onyx.cmd']('find', search)

    if not matches:
        ret['result'] = True
        ret['comment'] = 'Nothing found to replace'
        return ret

    if __opts__['test'] is True:
        ret['result'] = None
        ret['comment'] = 'Configs will be changed'
        ret['changes']['old'] = matches
        ret['changes']['new'] = [re.sub(name, repl, match) for match in matches]
        return ret

    ret['changes'] = __salt__['onyx.cmd']('replace', name, repl, full_match=full_match)

    matches = __salt__['onyx.cmd']('find', search)

    if matches:
        ret['result'] = False
        ret['comment'] = 'Failed to replace all instances of "{0}"'.format(name)
    else:
        ret['result'] = True
        ret['comment'] = 'Successfully replaced all instances of "{0}" with "{1}"'.format(name, repl)

    return ret