input: Write a function to generate a random string of a specified length. The string should consist of alphanumeric characters (both uppercase and lowercase letters, as well as digits). If no length is provided, the function should generate a string of length 10 by default.
  assert generate_string(10)
  assert generate_string(5)
  assert generate_string()
output: import random
  import string
  
  def generate_string(length=10):
      return ''.join(random.choices(string.ascii_letters + string.digits, k=length))