code: def _group_challenges(tokens: list) -> list:
      challenges = []
      while tokens:
          j = 1
          if len(tokens) == 1:
              pass
          elif tokens[1][0] == "comma":
              pass
          elif tokens[1][0] == "token":
              j = 2
          else:
              while j < len(tokens) and tokens[j][0] == "pair":
                  j += 2
              j -= 1
          challenges.append((tokens[0][1], tokens[1:j]))
          tokens[: j + 1] = []
      return challenges
  
file_path: wandb/wandb/docker/www_authenticate.py
imports: import re
  from collections import OrderedDict
  from typing import Any, Optional
label_desc: Use image node_id 3 for calling a global function with example usage: _group_challenges(tokens) and returns: challenges