input: Write a python function to perform basic arithmetic operations based on user input.
  assert calculator('add', 2, 3) == 5
  assert calculator('subtract', 10, 5) == 5
  assert calculator('multiply', 4, 5) == 20
  assert calculator('divide', 10, 2) == 5
  assert calculator('divide', 10, 0) == 'Cannot divide by zero'
output: def calculator(operation, a, b):
      if operation == 'add':
          return a + b
      elif operation == 'subtract':
          return a - b
      elif operation == 'multiply':
          return a * b
      elif operation == 'divide':
          if b == 0:
              return 'Cannot divide by zero'
          return a / b
      else:
          return 'Invalid operation'