input: Write a python function to generate a random password containing at least one uppercase character, one lowercase character, one digit, and one special character.
  assert len(generate_password(8)) == 10
  assert any(c.isupper() for c in generate_password(8))
  assert any(c.islower() for c in generate_password(8))
  assert any(c.isdigit() for c in generate_password(8))
  assert any(c in string.punctuation for c in generate_password(8))
output: import random
  import string
  
  def generate_password(length):
      if length < 4:
          raise ValueError("Password length must be at least 4")
      
      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)