def compare_versions(i):
    """
    Input:  {
              version1 - version 1 to compare against version2 (list such as [1,62])
              version2 - (list such as [1,63])
            }

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

              result       "<" - version 1 < version 2
                           "=" - version 1 == version 2
                           ">" - version 1 > version 2
            }

    """

    def compare_versions_core(v1_orig, v2_orig):

        len_diff = len(v2_orig)-len(v1_orig)    # determine the (signed) length of zero-padding

        # now pad the shorter to match the longer:
        (v1, v2) = (v1_orig + [0]*len_diff, v2_orig) if len_diff>0 else (v1_orig, v2_orig + [0]*-len_diff)

        for j in range(0,len(v1)):
            (t1, t2) = (type(v1[j]), type(v2[j]))
            if t1 == t2:        # perform natural comparison within the same type
                if v1[j]<v2[j]:
                    return '<'
                elif v1[j]>v2[j]:
                    return '>'
            elif t1 == int:     # but any integer is higher than any letter combination
                return '>'
            elif t2 == int:
                return '<'

        return '='

    result = compare_versions_core(i['version1'], i['version2'])

    if i.get('out','')=='con':
       ck.out(result)

    return {'return':0, 'result':result}