Parse an ISO datetime, which Python does buggily.

def parse_datetime(dt):
    '''Parse an ISO datetime, which Python does buggily.'''
    d = datetime.strptime(dt[:-1], ISOFORMAT)

    if dt[-1:] == 'Z':
        return timezone('utc').localize(d)
    else:
        return d