input: Write a python function to generate a random password with a minimum length of 8, containing at least one upper case letter, one lower case letter, one number, and one special character.
  assert len(generate_password()) >= 8
  assert any(c.islower() for c in generate_password())
  assert any(c.isupper() 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():
      length = 8
      lower = random.choice(string.ascii_lowercase)
      upper = random.choice(string.ascii_uppercase)
      digit = random.choice(string.digits)
      special = random.choice(string.punctuation)
      
      password = lower + upper + digit + special
      
      if length > 4:
          all_characters = string.ascii_letters + string.digits + string.punctuation
          password += ''.join(random.choice(all_characters) for i in range(length - 4))
      
      password = list(password)
      random.shuffle(password)
      
      return ''.join(password)