input: 
  def generate_password() -> str:
      """Generate a random password of length 8, comprising alphanumeric characters and at least one special character.
      >>> generate_password()
      's8!3Fj9k'
      >>> generate_password()
      'A%7*bn2z'
      """
      chars = string.ascii_letters + string.digits + string.punctuation
      pwd_length = 8
  
      password = ''
      for i in range(pwd_length):
          password += random.choice(chars)
      
      # Check if at least one special character exists in the password
      if any([char in string.punctuation for char in password]):
          return password
      else:
          return generate_password()
  
output:     while True:
          password = ''.join(random.choice(chars) for _ in range(pwd_length))
          if any(char in string.punctuation for char in password):
              return password