input: Write a function to merge two lists of integers into one sorted list without using the in-built sort function. The function should return the merged and sorted list. If either list is empty, it should return the non-empty list sorted.
  def merge_sort(list1, list2):
      merged_list = []
      while list1 and list2:
          if list1[0] < list2[0]:
              merged_list.append(list1.pop(0))
          else:
              merged_list.append(list2.pop(0))
      merged_list.extend(list1)
      merged_list.extend(list2)
      return merged_list
  
  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([], []) == []
output: def merge_sort(list1, list2):
      merged_list = []
      while list1 and list2:
          if list1[0] < list2[0]:
              merged_list.append(list1.pop(0))
          else:
              merged_list.append(list2.pop(0))
      merged_list.extend(list1)
      merged_list.extend(list2)
      return merged_list