code: def setup_groups(portal):
      
      logger.info("*** Setup Roles and Groups ***")
  
      portal_groups = api.get_tool("portal_groups")
  
      for gdata in GROUPS:
          group_id = gdata["id"]
          # create the group and grant the roles
          if group_id not in portal_groups.listGroupIds():
              logger.info("+++ Adding group {title} ({id})".format(**gdata))
              portal_groups.addGroup(group_id,
                                     title=gdata["title"],
                                     roles=gdata["roles"])
          # grant the roles to the existing group
          else:
              ploneapi.group.grant_roles(
                  groupname=gdata["id"],
                  roles=gdata["roles"],)
              logger.info("+++ Granted group {title} ({id}) the roles {roles}"
                          .format(**gdata))
docs: Setup roles and groups for BECHEM