input: Write a python function to encrypt a string using XOR encryption with a given key.
  assert xor_crypt_string(bytearray('Hello world!', 'utf-8'), 'key') == bytearray(b'\x03\x00\r\x07\x1bC\x00\x04\x0c\x07\n')
  assert xor_crypt_string(bytearray('Test', 'utf-8'), 'secret') == bytearray(b'F\x02\x1cW')
  assert xor_crypt_string(bytearray('Python', 'utf-8'), 'password') == bytearray(b'\x1f\x11\x11\x0c\n\r')
output: def xor_crypt_string(data: bytearray, key: str) -> bytearray:
      key_bytes = bytearray(key, 'utf-8')
      key_len = len(key_bytes)
      
      encrypted_data = bytearray()
      for i in range(len(data)):
          encrypted_data.append(data[i] ^ key_bytes[i % key_len])
      
      return encrypted_data