input: Write a python function to memoize a given function using a dictionary.
  assert memoize(lambda x: x*2, 5) == 10
  assert memoize(lambda x: x**2, 3) == 9
  assert memoize(lambda x: x+7, 4) == 11
output: def memoize(func, arg):
      cache = {}
      if arg in cache:
          return cache[arg]
      else:
          result = func(arg)
          cache[arg] = result
          return result