def _find_rteq(a, l, x):
 i = bisect_right(a, x, lo=l)
 if ((i != (len(a) + 1)) and (a[(i - 1)] == x)):
  return (i - 1)
 raise ValueError

def _find_rteq ( a , l , x ) : i = bisect_right ( a , x , lo = l ) if ( ( i != ( len ( a ) + 1 ) ) and ( a [ ( i - 1 ) ] == x ) ) : return ( i - 1 ) raise ValueError
locate the rightmost value exactly equal to x .