def check_version(branch, latest_hash=None):
    if branch == 'master':
        remote_dir = 'devel'
        regex = ("(?<=This documentation is for version <b>\d{1}\.\d{1}\."
                 "\d{1}\.dev-)(\w{7})")
    else:
        remote_dir = 'stable'
        regex = ("(?<=This documentation is for the <b>)(\d{1}\.\d{1}\.\d{1})"
                 "(?=</b> release.)")
    base_url = 'http://statsmodels.sourceforge.net/{}'
    page = urlopen(base_url.format(remote_dir)).read()

    try:
        version = re.search(regex, page).group()
    except __HOLE__:
        return True

    if remote_dir == 'stable':
        if last_release[1:] == version:
            return False
        else:
            return True

    # get the lastest hash
    if latest_hash == version:
        return False
    else:
        return True
dataset/ETHPy150Open statsmodels/statsmodels/tools/update_web.py/check_version