code: def _findPortalId(self):
          
          if not self.root.lower().endswith("/self"):
              url = self.root + "/self"
          else:
              url = self.root
          params = {
              "f" : "json"
          }
          res = self._get(url=url, param_dict=params,
                             securityHandler=self._securityHandler,
                             proxy_port=self._proxy_port,
                             proxy_url=self._proxy_url)
          if 'id' in res:
              return res['id']
          return None
docs: gets the portal id for a site if not known.