input: from typing import List
  
  def generate_random_password(length: int = 8) -> str:
      """ Generate a random password of the specified length, ensuring it contains at least one of each character type: 
      lowercase, uppercase, digits, and special characters.
      >>> generate_random_password()
      'aB1!?@z'
      >>> generate_random_password(12)
      'A7c@zY!2#X9F'
      """
      import string
      import random
  
      special_characters = "!#$%&'()*+,-./:;<=>?@[\]^_`{|}~"
      password = [
          random.choice(string.ascii_lowercase),
          random.choice(string.ascii_uppercase),
          random.choice(string.digits),
          random.choice(special_characters)
      ]
  
      all_characters = string.ascii_lowercase + string.ascii_uppercase + string.digits + special_characters
      for i in range(length - len(password)):
          password.append(random.choice(all_characters))
  
      random.shuffle(password)
      return ''.join(password)
output:     import string
      import random
  
      special_characters = "!#$%&'()*+,-./:;<=>?@[\]^_`{|}~"
      password = [
          random.choice(string.ascii_lowercase),
          random.choice(string.ascii_uppercase),
          random.choice(string.digits),
          random.choice(special_characters)
      ]
  
      all_characters = string.ascii_lowercase + string.ascii_uppercase + string.digits + special_characters
      for i in range(length - len(password)):
          password.append(random.choice(all_characters))
  
      random.shuffle(password)
      return ''.join(password)