def get_version(i):
    """
    Input:  {
              full_path
              bat
              cmd

              custom_script_obj
              host_os_dict

              (show)                 - if 'yes', show output file

              (skip_existing)        - if 'yes', force detecting version again
              (skip_add_target_file) - if 'yes', do not add target file at the beginning 
                                       of CMD to detect version

              (use_locale)           - if 'yes', use locale to decode output
            }

    Output: {
              return       - return code =  0, if successful
                                         >  0, if error
              (error)      - error text if return > 0

              version      - string version
              version_lst  - raw output (as list)
            }

    """

    import os

    o=i.get('out','')

    fp=i.get('full_path','')
    sb=i.get('bat','')
    soft_version_cmd=i.get('cmd')
    data_uid    = i.get('data_uid')

    cs=i.get('custom_script_obj', None)
    cus=i.get('customize',{})   # should we be more strict [] here?

    hosd=i.get('host_os_dict',{})
    tosd=i.get('target_os_dict',{})

    bprefix=hosd.get('batch_prefix','')
    ubtr=hosd.get('use_bash_to_run','')
    svarb=hosd.get('env_var_start','')
    svarb1=hosd.get('env_var_extra1','')
    svare=hosd.get('env_var_stop','')
    svare1=hosd.get('env_var_extra2','')
    sexe=hosd.get('set_executable','')
    sbp=hosd.get('bin_prefix','')
    envsep=hosd.get('env_separator','')
    scall=hosd.get('env_call','')
    sext=hosd.get('script_ext','')
    eifsc=hosd.get('env_quotes_if_space_in_call','')
    nout=hosd.get('no_output','')
    deps=i.get('deps',{})

    sb=bprefix+sb

    ver=''
    lst=[]
    cmd=''

    # Attempt to check via CK config file
    if i.get('skip_existing','')!='yes':
       rx=find_config_file({'full_path':fp, 'data_uid': data_uid})
       if rx['return']>0: return rx
       found=rx['found']
       if found=='yes':
          ver=rx['dict'].get('customize',{}).get('version','')

    if ver=='':
       # Preparing CMD
       if 'version_cmd' in dir(cs):
          rx=cs.version_cmd({'full_path':fp,
                             'host_os_dict':hosd,
                             'target_os_dict':tosd,
                             'cmd':soft_version_cmd,
                             'ck_kernel':ck,
                             'customize':cus,
                             'out':o,
                             'deps':deps})
          if rx['return']>0: return rx
          cmd=rx.get('cmd','')
          ver=rx.get('version','')

       elif soft_version_cmd:
          if eifsc!='' and fp.find(' ')>=0 and not fp.startswith(eifsc):
             fp=eifsc+fp+eifsc

          if o!='con':
             cmd+=nout

          if i.get('skip_add_target_file','')=='yes':
             cmd+=' '+soft_version_cmd
          else:
             cmd+=fp+' '+soft_version_cmd

    if ver=='' and cmd:

       # Generate tmp file
       rx=ck.gen_tmp_file({})
       if rx['return']>0: return rx
       ftmp=rx['file_name']