def get_profile(self, uid, password):
        c = self.connect()
        c.simple_bind_s(uid, password)
        ldap_result = c.search_s(self.users_base_dn, ldap.SCOPE_SUBTREE,
                                 '(userPrincipalName=%s)' % ldap.dn.escape_dn_chars(toUTF8(uid)))[0][1]
        profile = {}
        profile['uid'] = ldap_result['sAMAccountName'][0]
        profile['name'] = ldap_result['displayName'][0].decode('utf-8')
        profile['email'] = ldap_result.get('mail', [''])[0]
        profile['picture'] = ldap_result['thumbnailPhoto'][0] if 'thumbnailPhoto' in ldap_result else None
        c.unbind()
        return profile
dataset/ETHPy150Open Net-ng/kansha/kansha/authentication/ldap/ldap_auth.py/ADLDAPAuth.get_profile/original