input: Write a python function to generate a random password containing at least three out of the following four types of characters: uppercase letters, lowercase letters, digits, and special characters.
  assert len(random_password()) == 8
  assert any(x.isupper() for x in random_password())
  assert any(x.islower() for x in random_password())
  assert any(x.isnumeric() for x in random_password())
  assert any(x in string.punctuation for x in random_password())
output: import random
  import string
  
  def random_password():
      length = 8
      all_characters = string.ascii_letters + string.digits + string.punctuation
  
      # Ensure at least one character from three out of the four categories
      password = [
          random.choice(string.ascii_uppercase),
          random.choice(string.ascii_lowercase),
          random.choice(string.digits),
          random.choice(string.punctuation)
      ]
  
      # Fill the rest of the password length with random characters
      while len(password) < length:
          password.append(random.choice(all_characters))
  
      # Shuffle the list to ensure random order
      random.shuffle(password)
  
      return ''.join(password)