def astz(dt, tz):
    """
    Given a datetime object and a timezone object, return a new
    datetime object that represents the same moment, but written
    in terms of the new timezone.
    :param dt: a datetime object
    :param tz: a timezone object
    :return: a datetime object
    """
    # See http://pythonhosted.org/pytz/ for why this is
    # not as trivial as it might first appear.
    return tz.normalize(dt.astimezone(tz))