input: Write a function to generate a random password of length 8 characters, containing at least one uppercase letter, one lowercase letter, one digit, and one special character.
  
  assert generate_password()=="A1b2C3d4"
  assert generate_password()=="X9y8Z7w6"
  assert generate_password()=="P5q4R3s2"
  assert generate_password()=="M1n2O3p4"
  assert generate_password()=="L9k8J7h6"
output: import random
  import string
  
  def generate_password():
      characters = string.ascii_letters + string.digits + string.punctuation
      while True:
          password = ''.join(random.choice(characters) for i in range(8))
          if (any(c.isupper() for c in password) and
              any(c.islower() for c in password) and
              any(c.isdigit() for c in password) and
              any(c in string.punctuation for c in password)):
              return password