input: Write a function to optimize the given Python program to find the maximum number in a list. The function should return the maximum number in the list. If the list is empty, it should return None.
  
  
  def max_num(list):
      if not list:
          return None
      return max(list)
  
  # Test cases
  assert max_num([9, 2, 5, 6, 4, 1]) == 9
  assert max_num([7, 3, 8, 9, 2]) == 9
  assert max_num([1, 1, 1, 1]) == 1
  assert max_num([]) == None
  
output: def max_num(list):
      if not list:
          return None
      return max(list)