find_ugly_number python implementation