def _GetGroupMembersAndPermissions(self):
    group_users = {}

    # Loop over all permission types and all groups, expanding membership
    # and storing each group members permissions in a dict.
    for permission_type, groups in settings.GROUPS.iteritems():
      # Convert all permissions to sets to avoid duplicate permissions.
      groups = [(g, set(p)) for g, p in groups]

      for group, perms in groups:
        for user in self._GetGroupMembers(group):
          # To accomodate for users that exist in multiple groups, insert new
          # users with permissions and set or add permissions to existing users.
          if user not in group_users:
            group_users[user] = {permission_type: perms}
          elif permission_type not in group_users[user]:
            group_users[user][permission_type] = perms
          else:
            group_users[user][permission_type] = (
                group_users[user][permission_type].union(perms))
    return group_users

  # pylint: disable=g-bad-name
Configure rule.
dataset/ETHPy150Open google/cauliflowervest/src/cauliflowervest/server/cron/group_sync.py/GroupSync._GetGroupMembersAndPermissions--crossover with--dataset/ETHPy150Open mrjoes/flask-admin/flask_admin/form/rules.py/NestedRule.configure