input: 
  import string
  import random
  
  def generate_password(pwd_length: int) -> str:
      """Generate a random password of specified length, which consists of alphanumeric characters and at least one special character.
      >>> generate_password(8)
      '@D3fG!9'
      >>> generate_password(10)
      'rT3$s7xY2P'
      >>> generate_password(12)
      'Z@8bQ#1vL2m3'
      """
  
      chars = string.ascii_letters + string.digits + string.punctuation
      
      while True:
          password = ''.join(random.choices(chars, k=pwd_length))
          if any(char in string.punctuation for char in password):
              return password
  
  print(generate_password(8))
  
output:     chars = string.ascii_letters + string.digits + string.punctuation
      
      while True:
          password = ''.join(random.choices(chars, k=pwd_length))
          if any(char in string.punctuation for char in password):
              return password