code: def _get_user(self, username, attrs=ALL_ATTRS):
          
  
          username = ldap.filter.escape_filter_chars(username)
          user_filter = self.user_filter_tmpl % {
              'username': self._uni(username)
          }
          r = self._search(self._byte_p2(user_filter), attrs, self.userdn)
  
          if len(r) == 0:
              return None
  
          # if NO_ATTR, only return the DN
          if attrs == NO_ATTR:
              dn_entry = r[0][0]
          # in other cases, return everything (dn + attributes)
          else:
              dn_entry = r[0]
          return dn_entry
docs: Get a user from the ldap