code: def parse(value: str) -> CaseFoldedOrderedDict:
      tokens = []
      while value:
          for token_name, pattern in _tokens:
              match = pattern.match(value)
              if match:
                  value = value[match.end() :]
                  if token_name:
                      tokens.append((token_name, match.group(1)))
                  break
          else:
              raise ValueError("Failed to parse value")
      _group_pairs(tokens)
  
      challenges = CaseFoldedOrderedDict()
      for name, tokens in _group_challenges(tokens):  # noqa: B020
          args, kwargs = [], {}
          for token_name, value in tokens:
              if token_name == "token":
                  args.append(value)
              elif token_name == "pair":
                  kwargs[value[0]] = value[1]
          challenges[name] = (args and args[0]) or kwargs or None
  
      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 4 for calling a global function with example usage: parse(value) and returns: challenges