input: Write a python function to generate a random password of a given length using specified characters.
  assert len(generate_password(10)) == 10
  assert len(generate_password(5)) == 5
  assert len(generate_password(15)) == 15
output: import random
  import string
  
  def generate_password(length, chars=string.ascii_letters + string.digits + string.punctuation):
      return ''.join(random.choice(chars) for _ in range(length))