<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _findPortalId(self):
 """gets the portal id for a site if not known."""

        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