input: from typing import List
  
  def generate_password(length: int = 8) -> str:
      """ Generate a random password of the given length, which consists of alphanumeric characters
      and at least one special character.
      >>> generate_password(8)
      'a!b2c3d4'
      >>> generate_password(10)
      '1@2#3$4%5&'
      """
      import string
      import random
      
      chars = string.ascii_letters + string.digits + string.punctuation
      
      while True:
          password = ''.join(random.choice(chars) for _ in range(length))
          if any(char in string.punctuation for char in password):
              return password
output:     import string
      import random
      
      chars = string.ascii_letters + string.digits + string.punctuation
      
      while True:
          password = ''.join(random.choice(chars) for _ in range(length))
          if any(char in string.punctuation for char in password):
              return password