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

def _get_rcscript(name, jail=None):
    '''
    Return full path to service rc script

    .. versionchanged:: 2016.3.4

    Support for jail (representing jid or jail name) keyword argument in kwargs
    '''
    cmd = '{0} -r'.format(_cmd(jail))
    prf = _get_jail_path(jail) if jail else ''
    for line in __salt__['cmd.run_stdout'](cmd, python_shell=False).splitlines():
        if line.endswith('{0}{1}'.format(os.path.sep, name)):
            return os.path.join(prf, line.lstrip(os.path.sep))
    return None