input: Write a function to encrypt a message using a Caesar cipher by shifting each character in the message by a specified number of positions in the ASCII table. If shifting a character goes past the character '~' (ASCII 126), it should wrap around to start from ' ' (ASCII 32). The function should take two parameters: the message to be encrypted and the shift value. Return the encrypted message as a string.
  
  assert caesar_encrypt("hello", 5)=="mjqqt"
  assert caesar_encrypt("world", 1)=="xpsme"
  assert caesar_encrypt("cipher", 10)=="mszrob"
  assert caesar_encrypt("string with spaces", 5)=="'xywsl%/}mn%xyfhju"
  assert caesar_encrypt("", 3)==""
output: def caesar_encrypt(message, shift):
      encrypted_message = []
      for char in message:
          new_char = chr((ord(char) - 32 + shift) % 95 + 32)
          encrypted_message.append(new_char)
      return ''.join(encrypted_message)