added functools.wraps as per @richafrank