code: def struct_env_factory(
      max_pieces_in_inventory: int,
      raw_piece_size: Tuple[int, int],
      static_demand: List[Tuple[int, int]],
  ) -> StructuredCutting2DEnvironment:
      """Convenience factory function that compiles a trainable structured environment.
      (for argument details see: Cutting2DEnvironment)
      """
  
      # init maze environment including observation and action interfaces
      env = maze_env_factory(
          max_pieces_in_inventory=max_pieces_in_inventory,
          raw_piece_size=raw_piece_size,
          static_demand=static_demand,
      )
  
      # convert flat to structured environment
      return StructuredCutting2DEnvironment(env)
  
imports: from copy import deepcopy
  from typing import Dict, Any, Union, Tuple, Optional, List
  import gym
  import numpy
  from maze.core.env.maze_action import MazeActionType
  from maze.core.env.maze_env import MazeEnv
  from maze.core.env.maze_state import MazeStateType
  from maze.core.env.structured_env import StructuredEnv, ActorID
  from maze.core.env.structured_env_spaces_mixin import StructuredEnvSpacesMixin
  from maze.core.wrappers.wrapper import Wrapper
  from .maze_env import maze_env_factory
label_desc: Use image node_id 1 for calling a global function with example usage: struct_env_factory(max_pieces_in_inventory, raw_piece_size, static_demand) and returns: StructuredCutting2DEnvironment