code: def _resolve_version(version):
      
      if version is not LATEST:
          return version
  
      resp = urlopen('https://pypi.python.org/pypi/setuptools/json')
      with contextlib.closing(resp):
          try:
              charset = resp.info().get_content_charset()
          except Exception:
              # Python 2 compat; assume UTF-8
              charset = 'UTF-8'
          reader = codecs.getreader(charset)
          doc = json.load(reader(resp))
  
      return str(doc['info']['version'])
docs: Resolve LATEST version