py: Implement more complete bytes comparison handling.