input: Write a Python function to generate a random password of a given length containing upper case, lower case, digits, and special characters.
  assert len(genPassword(12))==12
  assert any(c.isupper() for c in genPassword(12))
  assert any(c.islower() for c in genPassword(12))
  assert any(c.isdigit() for c in genPassword(12))
  assert any(c in string.punctuation for c in genPassword(12))
output: import random
  import string
  
  def genPassword(length):
      if length < 4:
          raise ValueError("Password length must be at least 4 characters")
  
      all_chars = string.ascii_letters + string.digits + string.punctuation
  
      password = [
          random.choice(string.ascii_uppercase),
          random.choice(string.ascii_lowercase),
          random.choice(string.digits),
          random.choice(string.punctuation)
      ]
  
      password += random.choices(all_chars, k=length-4)
      random.shuffle(password)
      
      return ''.join(password)