Created has_twopair function.