def ifmatchinstance(tokens, classes):
    """
    >>> tokens = (TimeToken(15), TimeToken(16))
    >>> ifmatchinstance(tokens, (TimeToken, TimeToken))
    1
    >>> ifmatchinstance(tokens, (TimeToken, DayToken))
    0
    >>> both = (DayToken, TimeToken)
    >>> ifmatchinstance(tokens, (both, both))
    1
    >>> tokens = (TimeToken(15), DayToken(5, 7, 2018))
    >>> ifmatchinstance(tokens, (DayToken, TimeToken))
    -1
    >>> ifmatchinstance(tokens, ())
    0
    """
    if len(tokens) != len(classes):
        return 0
    if all([isinstance(token, cls) for token, cls in zip(tokens, classes)]):
        return 1
    if all([isinstance(token, cls) for token, cls in zip(tokens[::-1], classes)]):
        return -1
    return 0