def determine_end_of_role(prev_prefix, prefix):
    """
    determine whether the previous token was the last one of the role

    :param str prev_prefix: prefix of the previous BIO annotation
    :param str prefix: current prefix of BIO annotation

    :rtype: bool
    :return: True -> previous token was the last one, False -> either not in role or still in annotation
    """
    add_role = False

    if prefix != 'I':
        # current BIO annotation is O and previous one is I
        if prev_prefix == 'I':
            add_role = True

    return add_role