code: def get_object_details(self, user=None, group=None, dn_only=False):
          
  
          query = None
          fields = None
          if user is not None:
              if not dn_only:
                  fields = current_app.config['LDAP_USER_FIELDS']
              query = ldap_filter.filter_format(
                  current_app.config['LDAP_USER_OBJECT_FILTER'], (user,))
          elif group is not None:
              if not dn_only:
                  fields = current_app.config['LDAP_GROUP_FIELDS']
              query = ldap_filter.filter_format(
                  current_app.config['LDAP_GROUP_OBJECT_FILTER'], (group,))
          conn = self.bind
          try:
              records = conn.search_s(current_app.config['LDAP_BASE_DN'],
                                      ldap.SCOPE_SUBTREE, query, fields)
  
              conn.unbind_s()
              result = {}
              if records:
                  if dn_only:
                      if current_app.config['LDAP_OPENLDAP']:
                          if records:
                              return records[0][0]
                      else:
                          if current_app.config['LDAP_OBJECTS_DN'] \
                                  in records[0][1]:
                              dn = records[0][1][
                                  current_app.config['LDAP_OBJECTS_DN']]
                              return dn[0]
                  for k, v in list(records[0][1].items()):
                      result[k] = v
                  return result
          except ldap.LDAPError as e:
              raise LDAPException(self.error(e.args))
docs: Returns a ``dict`` with the object's (user or group) details.
  
          :param str user: Username of the user object you want details for.
          :param str group: Name of the group object you want details for.
          :param bool dn_only: If we should only retrieve the object's
              distinguished name or not. Default: ``False``.