def normalize(dt, tz=UTC):
    """
    Convert date or datetime to datetime with timezone.

    :param dt: date to normalize
    :param tz: the normalized date's timezone
    :return: date as datetime with timezone
    """
    if type(dt) is date:
        dt = dt + relativedelta(hour=0)
    elif type(dt) is datetime:
        pass
    else:
        raise ValueError("unknown type %s" % type(dt))

    if dt.tzinfo:
        dt = dt.astimezone(tz)
    else:
        dt = dt.replace(tzinfo=tz)

    return dt
def normalize ( dt , tz = UTC ) : if type ( dt ) is date : dt = dt + relativedelta ( hour = 0 ) elif type ( dt ) is datetime : pass else : raise ValueError ( "unknown type %s" % type ( dt ) ) if dt . tzinfo : dt = dt . astimezone ( tz ) else : dt = dt . replace ( tzinfo = tz ) return dt
Convert date or datetime to datetime with timezone.

    :param dt: date to normalize
    :param tz: the normalized date's timezone
    :return: date as datetime with timezone