def _time_string_format(dt, time_zone=None):
    """
    format a datetime based on time zone
    :param dt: datetime object
    :param time_zone: a timezone object, or None for local time zone
    :return:
    """
    return dt.astimezone(time_zone).isoformat()
