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

def version(syslog_ng_sbin_dir=None):
    '''
    Returns the version of the installed syslog-ng. If syslog_ng_sbin_dir is
    specified, it is added to the PATH during the execution of the command
    syslog-ng.

    CLI Example:

    .. code-block:: bash

        salt '*' syslog_ng.version
        salt '*' syslog_ng.version /home/user/install/syslog-ng/sbin
    '''
    try:
        ret = _run_command_in_extended_path(syslog_ng_sbin_dir,
                                            'syslog-ng',
                                            ('-V',))
    except CommandExecutionError as err:
        return _format_return_data(retcode=-1, stderr=six.text_type(err))

    if ret['retcode'] != 0:
        return _format_return_data(ret['retcode'],
                                   stderr=ret['stderr'],
                                   stdout=ret['stdout'])

    lines = ret['stdout'].split('\n')
    # The format of the first line in the output is:
    # syslog-ng 3.6.0alpha0
    version_line_index = 0
    version_column_index = 1
    line = lines[version_line_index].split()[version_column_index]
    return _format_return_data(0, stdout=line)