input: Write a python function to implement a Caesar cipher, which shifts characters in a string by a specified amount.
  assert caesar_cipher("hello world", 3) == "khoor zruog"
  assert caesar_cipher("abc", 1) == "bcd"
  assert caesar_cipher("xyz", 2) == "zab"
  assert caesar_cipher("HELLO", 5) == "MJQQT"
  assert caesar_cipher("Python", -2) == "Nvrflm"
output: def caesar_cipher(text, shift):
      result = []
      for char in text:
          if char.isalpha():
              shift_amount = shift % 26
              if char.islower():
                  new_char = chr((ord(char) - ord('a') + shift_amount) % 26 + ord('a'))
              else:
                  new_char = chr((ord(char) - ord('A') + shift_amount) % 26 + ord('A'))
              result.append(new_char)
          else:
              result.append(char)
      return ''.join(result)