import time


def timer(func):
    """time how long a function run"""

    def inner_function(*args, **kwargs):
        start_time = time.time()
        result = func(*args, **kwargs)
        duration = time.time() - start_time
        print("{} ran for {} seconds".format(func.__name__, duration))
        return result
    return inner_function