docs: def _populate_profile_from_group_memberships(self, profile):
          """
          Populate the given profile object from AUTH_LDAP_PROFILE_FLAGS_BY_GROUP.
          Returns True if the profile was modified.
          """
          save_profile = False
  
          for field, group_dns in self.settings.PROFILE_FLAGS_BY_GROUP.items():
              if isinstance(group_dns, six.string_types):
                  group_dns = [group_dns]
              value = any(self._get_groups().is_member_of(dn) for dn in group_dns)
              setattr(profile, field, value)
              save_profile = True
  
          return save_profile