from datetime import datetime


def call_and_return_with_timing(f, *args, **kwargs):
    """Helper for calling a function that returns (result, duration) where result
       is the returned value, and duration is the datetime.timedelta of the call.
       Exceptions are not caught.
    """
    before = datetime.now()
    result = f(*args, **kwargs)
    after = datetime.now()
    return (result, after-before)