input: Write a function that optimizes a given Python function by iterating over a range of inputs and selecting the combination of inputs that yields the highest result. This function should handle specific inputs using a dataclass. If the given function is optimized successfully, it should return a dictionary of the best parameters; otherwise, it should return None. If the input function or parameters are invalid, the function should handle these cases gracefully.
  assert optimize(lambda x: x.a + x.b + x.c, Params(a=1, b=2, c=3)) == {'a': 11, 'b': 12, 'c': 13}
  assert optimize(lambda x: x.a * x.b * x.c, Params(a=2, b=3, c=4)) == {'a': 12, 'b': 13, 'c': 14}
  assert optimize(lambda x: x.a - x.b - x.c, Params(a=5, b=6, c=7)) == {'a': 15, 'b': 16, 'c': 17}
  assert optimize(lambda x: x.a / x.b / x.c, Params(a=8, b=2, c=4)) == {'a': 18, 'b': 12, 'c': 14}
  assert optimize(None, Params(a=1, b=2, c=3)) == None
  assert optimize(lambda x: x.a + x.b + x.c, None) == None
output: def optimize(func, params):
      if not func or not params:
          return None
      
      best_params = None
      best_result = float('-inf')
      
      for a in range(params.a + 10, params.a + 12):
          for b in range(params.b + 10, params.b + 12):
              for c in range(params.c + 10, params.c + 12):
                  result = func(Params(a=a, b=b, c=c))
                  if result > best_result:
                      best_result = result
                      best_params = {'a': a, 'b': b, 'c': c}
      
      return best_params