input: Write a python function to generate a random password of given length that follows a specific pattern: uppercase letter, lowercase letter, digit, punctuation, and repeats this pattern. 
  assert len(generate_password(8)) == 8
  assert len(generate_password(12)) == 12
  assert len(generate_password(16)) == 16
output: import random
  import string
  
  def generate_password(length):
      if length % 4 != 0:
          raise ValueError("Length should be a multiple of 4")
      
      pattern = [string.ascii_uppercase, string.ascii_lowercase, string.digits, string.punctuation]
      password = []
      
      for i in range(length):
          character_set = pattern[i % 4]
          password.append(random.choice(character_set))
      
      random.shuffle(password)
      
      return ''.join(password)