input: from typing import List
  
  def generate_password(length: int = 8) -> str:
      """ Generate a random password of given length, consisting of alphanumeric characters
      and at least one special character.
      >>> generate_password()
      'a3F!s9q#'
      >>> generate_password(10)
      'z7@Lp2X5$G'
      """
      chars = string.ascii_letters + string.digits + string.punctuation
      password = ''
      for i in range(length):
          password += random.choice(chars)
      
      if any([char in string.punctuation for char in password]):
          return password
      else:
          return generate_password(length)
output:     import random
      import string
      
      chars = string.ascii_letters + string.digits + string.punctuation
      password = ''
      for i in range(length):
          password += random.choice(chars)
      
      if any([char in string.punctuation for char in password]):
          return password
      else:
          return generate_password(length)