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. If the given length is not 8, the function should return an empty string.
  import string
  import random
  
  def generate_password(length=8):
      if length != 8:
          return ""
      
      special_characters = "!#$%&'()*+,-./:;<=>?@[\]^_`{|}~"
      password = random.choice(string.ascii_lowercase)
      password += random.choice(string.ascii_uppercase)
      password += random.choice(string.digits)
      password += random.choice(special_characters)
      
      for i in range(4):
          password += random.choice(string.ascii_lowercase + string.ascii_uppercase + string.digits + special_characters)
      
      return ''.join(random.sample(password, len(password)))
  
  assert generate_password() != generate_password()
  assert len(generate_password()) == 8
  assert len(generate_password(10)) == 0
output: def generate_password(length=8):
      if length != 8:
          return ""
      
      special_characters = "!#$%&'()*+,-./:;<=>?@[\]^_`{|}~"
      password = random.choice(string.ascii_lowercase)
      password += random.choice(string.ascii_uppercase)
      password += random.choice(string.digits)
      password += random.choice(special_characters)
      
      for i in range(4):
          password += random.choice(string.ascii_lowercase + string.ascii_uppercase + string.digits + special_characters)
      
      return ''.join(random.sample(password, len(password)))