input: Write a function to find and return the maximum number from a given list. If the list is empty, return None. The input list can contain any integers. If the input list contains non-integer elements, those should be ignored.
  
  def max_num(nums):
      if not nums:
          return None
      max = None
      for num in nums:
          if isinstance(num, int):
              if max is None or num > max:
                  max = num
      return max
  
  assert max_num([5, 4, 2, 7, 12])==12
  assert max_num([-1, -5, -3])==-1
  assert max_num([10, "a", 3.5, 20, 15])==20
  assert max_num([])==None
  assert max_num([3.14, 5, -2, 8])==8
output: def max_num(nums):
      if not nums:
          return None
      max = None
      for num in nums:
          if isinstance(num, int):
              if max is None or num > max:
                  max = num
      return max