input: Write a function to generate a Random Password of length 8 characters, which contains at least one of each character type (lowercase, uppercase, digits, special characters). The function should return the generated password.
  assert generate_password()!=''
  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 "!#$%&'()*+,-./:;<=>?@[\]^_`{|}~" for c in generate_password())
output: import random
  import string
  
  def generate_password():
      lowercase = random.choice(string.ascii_lowercase)
      uppercase = random.choice(string.ascii_uppercase)
      digit = random.choice(string.digits)
      special = random.choice("!#$%&'()*+,-./:;<=>?@[\]^_`{|}~")
      remaining = random.choices(string.ascii_letters + string.digits + "!#$%&'()*+,-./:;<=>?@[\]^_`{|}~", k=4)
      password = lowercase + uppercase + digit + special + ''.join(remaining)
      return ''.join(random.sample(password, len(password)))