def resolve_principals(self, principals):
        principals_to_resolve = set(p for p in principals if p not in self._resolved_principals)

        if principals_to_resolve:
            xml = SP.ResolvePrincipals(SP.principalKeys(*(SP.string(p) for p in principals_to_resolve)))
            xml.append(SP.principalType('All'))
            result = self.opener.post_soap(PEOPLE_WEBSERVICE, xml)

            for principal_info in result.xpath('*/sp:PrincipalInfo', namespaces=namespaces):
                user_id = int(principal_info.find('sp:UserInfoID', namespaces=namespaces).text)
                account_name = principal_info.find('sp:AccountName', namespaces=namespaces).text
                display_name = principal_info.find('sp:DisplayName', namespaces=namespaces)
                display_name = display_name.text if display_name is not None else ''
                if user_id == -1:
                    raise ValueError("User {0} ({1}) not yet in SharePoint.".format(account_name,
                                                                                    display_name))
                self._resolved_principals[account_name] = self[user_id]

        return [self._resolved_principals.get(p) for p in principals]
dataset/ETHPy150Open ox-it/python-sharepoint/sharepoint/users.py/SharePointUsers.resolve_principals/original