input: Write a function to generate a random password of length 8 characters, containing at least one lowercase letter, one uppercase letter, one digit, and one special character. Return the generated password as a string.
  assert generate_password()=="AB1$ef2g"
  assert generate_password()=="Xy3@7z8T"
  assert generate_password()=="9L!mNp4Q"
  assert generate_password()=="R5@sWt6&"
  assert generate_password()=="2b$C8d#E"
output: import random
  import string
  
  def generate_password():
      lower = random.choice(string.ascii_lowercase)
      upper = random.choice(string.ascii_uppercase)
      digit = random.choice(string.digits)
      special = random.choice(string.punctuation)
      remaining = ''.join(random.choices(string.ascii_letters + string.digits + string.punctuation, k=4))
      password = lower + upper + digit + special + remaining
      return ''.join(random.sample(password, len(password)))