code: def CheckVersion(problems, latest_version=None):
    
    if not latest_version:
      timeout = 20
      socket.setdefaulttimeout(timeout)
      request = urllib2.Request(LATEST_RELEASE_VERSION_URL)
  
      try:
        response = urllib2.urlopen(request)
        content = response.read()
        m = re.search(r'version=(\d+\.\d+\.\d+)', content)
        if m:
          latest_version = m.group(1)
  
      except urllib2.HTTPError as e:
        description = ('During the new-version check, we failed to reach '
                       'transitfeed server: Reason: %s [%s].' %
                       (e.reason, e.code))
        problems.OtherProblem(
          description=description, type=errors.TYPE_NOTICE)
        return
      except urllib2.URLError as e:
        description = ('During the new-version check, we failed to reach '
                       'transitfeed server. Reason: %s.' % e.reason)
        problems.OtherProblem(
          description=description, type=errors.TYPE_NOTICE)
        return
  
    if not latest_version:
      description = ('During the new-version check, we had trouble parsing the '
                     'contents of %s.' % LATEST_RELEASE_VERSION_URL)
      problems.OtherProblem(
        description=description, type=errors.TYPE_NOTICE)
      return
  
    newest_version = _MaxVersion([latest_version, __version__])
    if __version__ != newest_version:
      problems.NewVersionAvailable(newest_version)
docs: Check if there is a newer version of transitfeed available.
  
    Args:
      problems: if a new version is available, a NewVersionAvailable problem will
        be added
      latest_version: if specified, override the latest version read from the
        project page