input: Write a python function to generate a random password with a mix of uppercase, lowercase, digits, and punctuation.
  assert len(generatePassword()) == 8
  assert any(c.islower() for c in generatePassword())
  assert any(c.isupper() for c in generatePassword())
  assert any(c.isdigit() for c in generatePassword())
  assert any(c in string.punctuation for c in generatePassword())
output: import random
  import string
  
  def generatePassword(length=8):
      if length < 4:
          raise ValueError("Password length should be at least 4 to accommodate all character types.")
      
      all_characters = string.ascii_letters + string.digits + string.punctuation
      password = [
          random.choice(string.ascii_lowercase),
          random.choice(string.ascii_uppercase),
          random.choice(string.digits),
          random.choice(string.punctuation)
      ]
      
      password += random.choices(all_characters, k=length-4)
      random.shuffle(password)
      
      return ''.join(password)