input: Write a function to optimize a Python algorithm that finds the greatest 2 numbers from a list of 10000 integers. If the list is empty, return (None, None). The function should return a tuple (max1, max2).
  def get_greatest_2(items):
   max1 = max2 = float('-inf') if items else None
   for item in items:
   if item > max1:
   max1, max2 = item, max1
   elif item > max2:
   max2 = item
   return max1, max2
  
  myList = [1, 5, 3, 7, 4, 7, 8, 9, 2, 10, 6, 8]
  assert get_greatest_2(myList) == (10, 9)
  
  myList2 = [3, 5, 10, 1, 2]
  assert get_greatest_2(myList2) == (10, 5)
  
  myList3 = []
  assert get_greatest_2(myList3) == (None, None)
  
  myList4 = [4]
  assert get_greatest_2(myList4) == (4, None)
  
  myList5 = [7, 3, 5, 8, 2, 3, 8, 6, 1, 2]
  assert get_greatest_2(myList5) == (8, 8)
  
  Output:
  get_greatest_2(myList) should return (10, 9)
output: 
  def get_greatest_2(items):
      if not items:
          return None, None
      max1 = max2 = float('-inf')
      for item in items:
          if item > max1:
              max1, max2 = item, max1
          elif item > max2:
              max2 = item
      return max1, max2 if max2 != float('-inf') else None
  