input: Write a function to generate a random password with a length of 8 characters, containing at least one uppercase letter, one lowercase letter, one digit, and one special character.
  assert generate_password()[0] in string.ascii_uppercase
  assert generate_password()[1] in string.ascii_lowercase
  assert generate_password()[2] in string.digits
  assert generate_password()[3] in string.punctuation
  assert len(generate_password()) == 8
output: import random
  import string
  
  def generate_password():
      password = []
      password.append(random.choice(string.ascii_uppercase))
      password.append(random.choice(string.ascii_lowercase))
      password.append(random.choice(string.digits))
      password.append(random.choice(string.punctuation))
      all_chars = string.ascii_uppercase + string.ascii_lowercase + string.digits + string.punctuation
      password.extend(random.choices(all_chars, k=4))
      random.shuffle(password)
      return ''.join(password)