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