code: def generate_short_url(self):
          
          from yacms.conf import settings
          if settings.BITLY_ACCESS_TOKEN:
              url = "https://api-ssl.bit.ly/v3/shorten?%s" % urlencode({
                  "access_token": settings.BITLY_ACCESS_TOKEN,
                  "uri": self.get_absolute_url_with_host(),
              })
              response = loads(urlopen(url).read().decode("utf-8"))
              if response["status_code"] == 200:
                  return response["data"]["url"]
          return SHORT_URL_UNSET
docs: Returns a new short URL generated using bit.ly if credentials for the
          service have been specified.