code: def expand_environments(environments: Dict[str, List[str]]):
      """
      `environments` is a map from variable names to a list of strings.
      Return: a list of environments, where for each variable, we choose one of its string.
      """
      output_environments: List[Dict[str, str]] = []
  
      def recurse(
          old_items: List[Tuple[str, List[str]]],
          new_items: List[Tuple[str, str]],
      ):
          if len(output_environments) >= MAX_EXPANSION:
              return
          if len(old_items) == 0:
              output_environments.append(dict(new_items))
          else:
              item, rest_old_items = old_items[0], old_items[1:]
              key, list_value = item
              for elem_value in list_value:
                  recurse(
                      rest_old_items, new_items + [(key, elem_value)]
                  )
  
      recurse(list(environments.items()), [])
      return output_environments
  
imports: import mako.template
  from abc import ABC, abstractmethod
  from dataclasses import dataclass
  from typing import Dict, List, Tuple, Any
  from helm.common.general import parse_hocon
  from helm.common.critique_request import CritiqueRequest, CritiqueRequestResult
  from helm.common.perspective_api_request import PerspectiveAPIRequestResult, PerspectiveAPIRequest
  from helm.common.tokenization_request import WindowServiceInfo, TokenizationRequest, TokenizationRequestResult, DecodeRequest, DecodeRequestResult
  from helm.common.request import Request, RequestResult
  from helm.proxy.models import Model
  from helm.proxy.query import Query, QueryResult
  from helm.proxy.accounts import Authentication, Account
label_desc: Use image node_id 1 for calling a global function with example usage: expand_environments(environments) and returns: output_environments