input: Write a python function to generate a random password of specified length with a specified number of special characters using provided allowed characters.
  assert len(generate_password(10, 2, 'abcdefghijklmnopqrstuvwxyz')) == 10
  assert sum(c in '!@#$%^&*' for c in generate_password(10, 2, 'abcdefghijklmnopqrstuvwxyz')) == 2
  assert all(c in 'abcdefghijklmnopqrstuvwxyz!@#$%^&*' for c in generate_password(10, 2, 'abcdefghijklmnopqrstuvwxyz'))
output: import random
  
  def generate_password(length, special_count, allowed_chars):
      special_chars = '!@#$%^&*'
      if special_count > length:
          raise ValueError("Number of special characters cannot exceed the total length")
      
      password = [
          random.choice(special_chars) for _ in range(special_count)
      ] + [
          random.choice(allowed_chars) for _ in range(length - special_count)
      ]
      
      random.shuffle(password)
      return ''.join(password)