input: Write a function to encrypt a message using a key in Python. The function should return the encrypted message as a string. If the message or key is empty, the function should return an empty string.
  assert encrypt("Hello world!", "secret")=="ŞěěőőŖ‼pvďxìY"
  assert encrypt("Hello", "key")=="Zvqqyr"
  assert encrypt("", "key")==""
  assert encrypt("Hello", "")==""
output: def encrypt(message, key):
      if not message or not key:
          return ""
      encrypted_message = ""
      key_length = len(key)
      for i, char in enumerate(message):
          shift = ord(key[i % key_length])
          encrypted_char = chr((ord(char) + shift) % 256)
          encrypted_message += encrypted_char
      return encrypted_message