def check_for_updates(package_name, latest_version_str, our_version_str=VERSION):
    """
        check if the API reports a version that is greater then our currently
        installed one
    """
    our = dict()
    latest = dict()
    for version, suffix in ((our, our_version_str), (latest, latest_version_str)):
        for part in ['major', 'minor', 'patch']:
            version[part], _, suffix = suffix.partition('.')
            version[part] = int(version[part])
        version['suffix'] = suffix

    for part in ['major', 'minor', 'patch', 'suffix']:
        if latest[part] > our[part]:
            if part == 'major':
                sys.exit(messages['UpdateRequired'].format(package_name))
            else:
                print >> sys.stderr, messages['UpdateAvailable'].format(package_name)
            return
dataset/ETHPy150Open cloudControl/cctrl/cctrl/common.py/check_for_updates/original