input: Write a python function to generate a random password with a length of 8 characters.
  assert len(generate_password()) == 8
  assert isinstance(generate_password(), str)
  assert any(char.isdigit() for char in generate_password())
  assert any(char.isalpha() for char in generate_password())
  assert any(char in string.punctuation for char in generate_password())
output: import random
  import string
  
  def generate_password():
      characters = string.ascii_letters + string.digits + string.punctuation
      password = ''.join(random.choice(characters) for _ in range(8))
      while not (any(char.isdigit() for char in password) and 
                 any(char.isalpha() for char in password) and 
                 any(char in string.punctuation for char in password)):
          password = ''.join(random.choice(characters) for _ in range(8))
      return password