def portalServerHandler(self, serverUrl, username=None):
        """
        returns a handler to access a federated server

        serverUrl - url to the server. Example:
                    https://server.site.com/arcgis
        username - the portal site username. if None is passed, it obtains
         it from the portal properties
        Outout:
          returns a PortalServerSecurityHandler object

        Usage:
        >>> # access the administration site
        >>> serverUrl="https://mysite.site.com/arcgis"
        >>> newSH = sh.portalServerHandler(serverUrl=serverUrl,
                                           username=None)
        >>> agsAdmin = AGSAdministration(url=serverUrl, securityHandler=newSH)
        >>> print agsAdmin.info
        >>> # access a secure service from portal handler
        >>> msUrl = "https://mysite.site.com:6443/arcgis/rest/services/SampleWorldCities/MapServer"
        >>> ms = arcrest.ags.MapService(url=msUrl, securityHandler=newSH)
        >>> print ms.mapName
        """


        from ..manageorg import Administration
        admin = Administration(url=self._org_url,
                               securityHandler=self,
                               proxy_url=self._proxy_url,
                               proxy_port=self._proxy_port)

        token_url = admin.tokenURL

        if username is None:
            username = self._login_username

        ptsh = PortalTokenSecurityHandler(username=username,
                                          password=self._password,
                                          org_url=self._org_url,
                                          token_url=token_url,
                                          proxy_url=self._proxy_url,
                                          proxy_port=self._proxy_port,
                                          jar=self.cookiejar,
                                          handler=self.handler)

        pssh = PortalServerSecurityHandler(tokenHandler=ptsh,
                                           serverUrl=serverUrl,
                                           referer=self._referer_url,
                                           jar=self.cookiejar,
                                           handler=self.handler)


        return pssh
returns a handler to access a federated server

        serverUrl - url to the server. Example:
                    https://server.site.com/arcgis
        username - the portal site username. if None is passed, it obtains
         it from the portal properties
        Outout:
          returns a PortalServerSecurityHandler object

        Usage:
        >>> # access the administration site
        >>> serverUrl="https://mysite.site.com/arcgis"
        >>> newSH = sh.portalServerHandler(serverUrl=serverUrl,
                                           username=None)
        >>> agsAdmin = AGSAdministration(url=serverUrl, securityHandler=newSH)
        >>> print agsAdmin.info
        >>> # access a secure service from portal handler
        >>> msUrl = "https://mysite.site.com:6443/arcgis/rest/services/SampleWorldCities/MapServer"
        >>> ms = arcrest.ags.MapService(url=msUrl, securityHandler=newSH)
        >>> print ms.mapName