'Make sure the datetime is within a minute from `now`.'

def assertCloseToNow(self, dt, now=None):

    if isinstance(dt, basestring):
        try:
            dt = dateutil_parser(dt)
        except ValueError as e:
            raise AssertionError(('Expected    valid    date;    got    %s\n%s' % (dt, e)))
    if (not dt):
        raise AssertionError(('Expected    datetime;    got    %s' % dt))
    dt_later_ts = time.mktime((dt + timedelta(minutes=1)).timetuple())
    dt_earlier_ts = time.mktime((dt - timedelta(minutes=1)).timetuple())
    if (not now):
        now = datetime.now()
    now_ts = time.mktime(now.timetuple())
    assert (dt_earlier_ts < now_ts < dt_later_ts), ('Expected    datetime    to    be    within    a    minute    of    %s.    Got    %r.' % (now, dt))
