input: Write a function to merge two lists of integers into one sorted list without using the in-built sort function. If either list is empty, the function should return the non-empty list sorted.
  assert merge_sort([3, 5, 9, 1, 8], [4, 11, 7, 2])==[1, 2, 3, 4, 5, 7, 8, 9, 11]
  assert merge_sort([], [4, 11, 7, 2])==[2, 4, 7, 11]
  assert merge_sort([3, 5, 9, 1, 8], [])==[1, 3, 5, 8, 9]
  assert merge_sort([2, 1], [5, 4, 3])==[1, 2, 3, 4, 5]
  assert merge_sort([], [])==[]
output: def merge_sort(list1, list2):
      if not list1:
          return list2
      if not list2:
          return list1
      merged = []
      i, j = 0, 0
      while i < len(list1) and j < len(list2):
          if list1[i] < list2[j]:
              merged.append(list1[i])
              i += 1
          else:
              merged.append(list2[j])
              j += 1
      merged.extend(list1[i:])
      merged.extend(list2[j:])
      return merged