import time


def function_timer(text, function, *args):
    """Displays the message *text* and returns the time taken for a
    function, with arguments *args*, to execute. The value returned by the
    timed function is also returned.

    :param string text: Message to display
    :param function: Function to time and execute
    :type function: function
    :param args: Function arguments
    :return: Value returned from the function
    """

    start_time = time.time()

    if text != "":
        print(text)

    result = function(*args)

    if text != "":
        print("----completed in {0:.6f} seconds---".format(
            time.time() - start_time))

    return result