helper methods for normalizing dates
I think this SDK should make it dead simple to sanitize things like dates. I don't know if there is a library for this already somewhere, probably. Here are two methods that I hacked together:
# normalize to days, throwing away hour, minute, second, and time zone
dt = parsed['time_received_datetimeobj']
timestamp = int(datetime.strptime(dt.isoformat().split('T')[0], '%Y-%m-%d').timestamp())
timestamp = int(datetime.strptime(dt.strftime('%Y-%m-%d'), '%Y-%m-%d').timestamp())
# normalize to weeks
timestamp = int(datetime.strptime(dt.strftime('%G %V 1'), '%G %V %w').timestamp())