Write a function called calculate that takes 3 values. The first and third values are numbers. The second value is a character. If the character is "+" , "-", "*", or "/", the function will return the result of the corresponding mathematical function on the two numbers. If the string is not one of the specified characters, the function should return null (throw an `ArgumentException` in C#).
Keep in mind, you cannot divide by zero. If an attempt to divide by zero is made, return null (throw an `ArgumentException` in C#)/(None in Python).
from operator import add, sub, mul
def calculate(num1, operation, num2): 
    d = {'+': add, '-': sub, '*': mul, '/': lambda a, b: a / b if b else None}
    return d.get(operation, lambda a, b: None)(num1, num2)
from operator import add, sub, mul
def calculate(num1, operation, num2): 
    d = {'+': add, '-': sub, '*': mul, '/': lambda a, b: a / b if b else None}
    return d.get(operation, lambda a, b: None)(num1, num2)