Display group membership sorted by group.

        Returns:
            Array with a dictionary of group membership.
                For example: {'testgroup': ['test.user', 'test.user2']}

def by_group(self):  # pragma: no cover
        """
        Display group membership sorted by group.

        Returns:
            Array with a dictionary of group membership.
                For example: {'testgroup': ['test.user', 'test.user2']}

        """
        group_membership = {}
        for record in self.__get_groups_with_membership():
            group_membership[record.cn.value] = [
                i for i in record.memberUid.values
            ]
        return group_membership