input: Write a function to generate a random password with a minimum length of 8 characters, containing at least one number and one special character. If the generated password meets the criteria, return the password as a string. If not, generate a new password until the criteria are met.
  assert generate_password()==some_valid_password
  assert len(generate_password())>=8
  assert any(char.isdigit() for char in generate_password())
  assert any(char in string.punctuation for char in generate_password())
output: import random
  import string
  
  def generate_password():
      while True:
          password = ''.join(random.choices(string.ascii_letters + string.digits + string.punctuation, k=8))
          if any(char.isdigit() for char in password) and any(char in string.punctuation for char in password):
              return password