You could just effect last_period with this check to be DRY. 

Side comment for the future - why not just allow the user to enter the delta with '--hours' and '--days'? Can be addressed with another patch or not at all; just a suggestion since it'd remove the branching and make it data driven.

Then just last_period = time - datetime.timedelta(days=args.days, hours=args.hours, ...)