input: Write a python function to generate a random password of a given length that includes at least one lowercase letter, one uppercase letter, one digit, and one special character.
  assert len(generate_password(10)) == 10
  assert len(generate_password(15)) == 15
  assert any(c.islower() for c in generate_password(10))
  assert any(c.isupper() for c in generate_password(10))
  assert any(c.isdigit() for c in generate_password(10))
  assert any(c in string.punctuation for c in generate_password(10))
output: import random
  import string
  
  def generate_password(length):
      if length < 4:
          raise ValueError("Password length must be at least 4 characters")
          
      characters = [
          random.choice(string.ascii_lowercase),
          random.choice(string.ascii_uppercase),
          random.choice(string.digits),
          random.choice(string.punctuation)
      ]
      
      if length > 4:
          characters += random.choices(string.ascii_letters + string.digits + string.punctuation, k=length-4)
      
      random.shuffle(characters)
      
      return ''.join(characters)