input: from typing import List
  
  def generate_password(length: int = 8) -> str:
      """ Generates a random password of specified length, which consists of alphanumeric 
      characters and at least one special character.
      >>> generate_password(8)
      '<random_password>'
      >>> generate_password(12)
      '<random_password>'
      """
      import string
      import random
  
      chars = string.ascii_letters + string.digits + string.punctuation
      password = ''.join(random.choice(chars) for _ in range(length))
  
      if any([char in string.punctuation for char in password]):
          return password
      else:
          return generate_password(length)
output:     import string
      import random
  
      chars = string.ascii_letters + string.digits + string.punctuation
      password = ''.join(random.choice(chars) for _ in range(length))
  
      if any([char in string.punctuation for char in password]):
          return password
      else:
          return generate_password(length)