input: Write a python function to generate a random password with at least one uppercase letter, one lowercase letter, one digit, and one special character.
  assert len(generate_password()) >= 8
  assert any(c.islower() for c in generate_password())
  assert any(c.isupper() for c in generate_password())
  assert any(c.isdigit() for c in generate_password())
  assert any(c in string.punctuation for c in generate_password())
output: import random
  import string
  
  def generate_password():
      length = random.randint(8, 12)
      password = [
          random.choice(string.ascii_uppercase),
          random.choice(string.ascii_lowercase),
          random.choice(string.digits),
          random.choice(string.punctuation),
      ]
      password += random.choices(string.ascii_letters + string.digits + string.punctuation, k=length-4)
      random.shuffle(password)
      return ''.join(password)