input: Write a python function to generate a password of a specified length with at least one uppercase letter, one lowercase letter, one digit, and one special character.
  assert len(PasswordGenerator(10).generate_password()) == 10
  assert any(char.isupper() for char in PasswordGenerator(10).generate_password())
  assert any(char.islower() for char in PasswordGenerator(10).generate_password())
  assert any(char.isdigit() for char in PasswordGenerator(10).generate_password())
  assert any(not char.isalnum() for char in PasswordGenerator(10).generate_password())
output: import random
  import string
  
  class PasswordGenerator:
      def __init__(self, length):
          self.length = length
  
      def generate_password(self):
          if self.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)
          ]
  
          if self.length > 4:
              remaining_length = self.length - 4
              password += random.choices(string.ascii_letters + string.digits + string.punctuation, k=remaining_length)
  
          random.shuffle(password)
          return ''.join(password)