import time


def timeit(callback, message):
    """Measure the time taken to execute a function.

    This function measures the amount of time it takes to execute the
    specified callback and prints a message afterwards regarding the
    time taken. The `message` parameter provides part of the message,
    e.g. if `message` is 'Executed', the printed message is 'Executed in
    1.234567 seconds'.

    Args:
        callback: Function to execute and time.
        message (str): Message to print after executing the callback.

    Returns:
        The return value of the callback.
    """
    onset = time.time()
    x = callback()

    print('{} in {:.3f} seconds'.format(message, time.time() - onset))

    return x