input: Write a python function to generate a password containing uppercase, lowercase, digits, and punctuation.
  assert len(generate_password()) == 8
  assert any(c.isupper() for c in generate_password())
  assert any(c.islower() 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():
      characters = [
          random.choice(string.ascii_uppercase),
          random.choice(string.ascii_lowercase),
          random.choice(string.digits),
          random.choice(string.punctuation)
      ]
      
      while len(characters) < 8:
          characters.append(random.choice(string.ascii_letters + string.digits + string.punctuation))
      
      random.shuffle(characters)
      return ''.join(characters)