input: Write a function to generate a random password given a set of letters, numbers, and characters. If the password length is not provided, default to 8 characters. The function should return the generated password as a string.
  assert generate_password()==random.choice(["aB3!8*2e", "zX7@9f6R", "yQ1#4d5T"])
  assert generate_password()==random.choice(["aB3!8*2e", "zX7@9f6R", "yQ1#4d5T"])
  assert generate_password(10)==random.choice(["aB3!8*2exy", "zX7@9f6Rhj", "yQ1#4d5Tgf"])
  assert generate_password(12)==random.choice(["aB3!8*2exyzm", "zX7@9f6Rhjki", "yQ1#4d5Tgfop"])
  assert generate_password(4)==random.choice(["aB3!", "zX7@", "yQ1#"])
output: import random
  import string
  
  def generate_password(length=8):
      characters = string.ascii_letters + string.digits + string.punctuation
      return ''.join(random.choice(characters) for _ in range(length))