input: Write a function to create an encrypted message using a key in Python. If the message and key are provided, return the encrypted message as a string. If the message is empty, return an empty string.
  assert encrypt("Hello world!", "secret")=="Tqxx{,|-}"
  assert encrypt("Python", "key")=="d}yrty"
  assert encrypt("Encryption", "1")=="Fodsjqujp"
  assert encrypt("OpenAI", "AI")=="UtrdLI"
  assert encrypt("", "")==""
output: def encrypt(message, key):
      if not message:
          return ""
      encrypted_message = []
      key_len = len(key)
      for i, char in enumerate(message):
          shift = ord(key[i % key_len])
          encrypted_char = chr((ord(char) + shift - 32) % 95 + 32)
          encrypted_message.append(encrypted_char)
      return "".join(encrypted_message)