input: Write a function to optimize any given Python function by fine-tuning its parameters within a specified range. The function should return the best combination of parameters that optimize the given function's output.
  assert optimize(get_result, Params(a=1, b=2, c=3))=={'a': 1, 'b': 2, 'c': 3}
  assert optimize(get_result, Params(a=10, b=20, c=30))=={'a': 10, 'b': 20, 'c': 30}
  assert optimize(lambda p: p.a * p.b * p.c, Params(a=2, b=2, c=2))=={'a': 0, 'b': 0, 'c': 0}
  assert optimize(get_result, Params(a=-5, b=-5, c=-5))=={'a': -5, 'b': -5, 'c': -5}
output: def optimize(func, params):
      best_params = params
      best_result = func(params)
      for a in range(params.a - 1, params.a + 2):
          for b in range(params.b - 1, params.b + 2):
              for c in range(params.c - 1, params.c + 2):
                  current_params = Params(a=a, b=b, c=c)
                  current_result = func(current_params)
                  if current_result < best_result:
                      best_result = current_result
                      best_params = current_params
      return best_params.__dict__