code: def plot_maze(maze: np.ndarray, show=False, save_img=False) -> None:
      """
      Plots a maze using matplotlib.
  
      Args:
          maze (np.ndarray): A NumPy array representing the maze.
          show (bool): Show the plot if True, default is False.
          save_img (bool): Save the plot as an image if True, default is False.
      """
      import os
  
      import matplotlib.pyplot as plt
      from matplotlib.colors import ListedColormap
      from matplotlib.patches import Patch
  
      # Set custom colormap for maze
      path_color = "white"
      wall_color = "black"
      start_color = "blue"
      end_color = "green"
      cmap = ListedColormap(
          [path_color, wall_color, start_color, end_color]
      )
  
      # Create legend
      legend_elements = [
          Patch(facecolor=path_color, edgecolor="black", label="Path"),
          Patch(facecolor=wall_color, edgecolor="black", label="Wall"),
          Patch(
              facecolor=start_color, edgecolor="black", label="Start"
          ),
          Patch(facecolor=end_color, edgecolor="black", label="End"),
      ]
  
      plt.imshow(maze, cmap=cmap)
      plt.legend(
          handles=legend_elements,
          bbox_to_anchor=(1.05, 1),
          loc="upper left",
      )
      if save_img:
          output_folder = "images"
          if not os.path.exists(output_folder):
              os.makedirs(output_folder)
          height, width = maze.shape
          file_path = os.path.join(
              output_folder,
              f"maze-{height}x{width}-{len(os.listdir(output_folder))}.png",
          )
          plt.savefig(file_path)
  
      if show:
          plt.show()
  
      plt.clf()
  
file_path: evals/evals/registry/data/mazes/nxn_maze_eval_generator.py
imports: import concurrent.futures
  import json
  import os
  import random
  import threading
  from typing import Dict, List, Tuple, Union
  import networkx
  import numpy
  from numpy import ndarray
  from tqdm import tqdm
label_desc: Use image node_id 8 for calling a global function with example usage: plot_maze(maze, show, save_img) without return types