input: Write a python function to generate a random password of given length.
  assert len(gen_password(8)) == 8
  assert len(gen_password(12)) == 12
  assert isinstance(gen_password(10), str)
output: import random
  import string
  
  def gen_password(length):
      characters = string.ascii_letters + string.digits + string.punctuation
      password = ''.join(random.choice(characters) for i in range(length))
      return password