code: def generate_lorem_ipsum(
      n: int = 5, html: bool = True, min: int = 20, max: int = 100
  ) -> str:
      """Generate some lorem ipsum for the template."""
      from .constants import LOREM_IPSUM_WORDS
  
      words = LOREM_IPSUM_WORDS.split()
      result = []
  
      for _ in range(n):
          next_capitalized = True
          last_comma = last_fullstop = 0
          word = None
          last = None
          p = []
  
          # each paragraph contains out of 20 to 100 words.
          for idx, _ in enumerate(range(randrange(min, max))):
              while True:
                  word = choice(words)
                  if word != last:
                      last = word
                      break
              if next_capitalized:
                  word = word.capitalize()
                  next_capitalized = False
              # add commas
              if idx - randrange(3, 8) > last_comma:
                  last_comma = idx
                  last_fullstop += 2
                  word += ","
              # add end of sentences
              if idx - randrange(10, 20) > last_fullstop:
                  last_comma = last_fullstop = idx
                  word += "."
                  next_capitalized = True
              p.append(word)
  
          # ensure that the paragraph ends with a dot.
          p_str = " ".join(p)
  
          if p_str.endswith(","):
              p_str = p_str[:-1] + "."
          elif not p_str.endswith("."):
              p_str += "."
  
          result.append(p_str)
  
      if not html:
          return "\n\n".join(result)
      return markupsafe.Markup(
          "\n".join(f"<p>{markupsafe.escape(x)}</p>" for x in result)
      )
  
imports: import enum
  import json
  import os
  import re
  import typing
  from collections import abc
  from collections import deque
  from random import choice
  from random import randrange
  from threading import Lock
  from types import CodeType
  from urllib.parse import quote_from_bytes
  import markupsafe
label_desc: Use image node_id 13 for calling a global function with example usage: generate_lorem_ipsum(n, html, min, max) and returns: markupsafe, str