def _compare_transition_to_match(transition, match):
    """Determine if transition_time applies to given range of the match.
    To compare the Transition time to the ZoneMatch time properly, the
    transition time of the Transition should be expanded to include all 3
    versions ('w', 's', and 'u') of the time stamp. When comparing against the
    ZoneMatch.startDateTime and ZoneMatch.untilDateTime, the version will be
    determined by the modifier of those parameters.

    Return:
        * -1 if less than match
        * 0 if equal to match_start
        * 1 if within match,
        * 2 if greater than match
    """
    match_start = match.startDateTime
    if match_start.f == 'w':
        transition_time = transition.transitionTime
    elif match_start.f == 's':
        transition_time = transition.transitionTimeS
    elif match_start.f == 'u':
        transition_time = transition.transitionTimeU
    else:
        raise Exception("Unknown modifier: %s" % match_start)
    if transition_time < match_start:
        return -1
    if transition_time == match_start:
        return 0

    match_until = match.untilDateTime
    if match_until.f == 'w':
        transition_time = transition.transitionTime
    elif match_until.f == 's':
        transition_time = transition.transitionTimeS
    elif match_until.f == 'u':
        transition_time = transition.transitionTimeU
    else:
        raise Exception("Unknown modifier: %s" % match_until)
    if match_until <= transition_time:
        return 2

    return 1