def infer_index_rep(motif, postfilter):
    """
    Infer index of a repeated element from postfilter and motif. Return 2 if not found.
    :param motif: list(tuple(seq, rep)) - motif object
    :param postfilter: list(int)/None - postfilter numbers
    :return: int - 1-based inferred index of a repeated element
    """
    started = False
    if postfilter is None:
        return 2
    for i, ((seq, rep), pf) in enumerate(zip(motif, postfilter)):
        if rep > 1 and pf > 0 and started:
            return i + 1
        if pf > 0:
            started = True
    return 2