import colorsys


def rgb_to_hsv(rgb):
    """Convert an RGB tuple to an HSV tuple for the same color. Both tuples should obey PIL rules,
    e.g. have 3 integers each ranging 0-255.

    Args:
        rgb (Tuple[ :obj:`int` ]): RGB tuple to convert to HSV.

    Returns:
        Tuple[ :obj:`int` ]: HSV tuple.
    """
    r, g, b = rgb
    fr, fg, fb = r / 255, g / 255, b / 255
    fh, fs, fv = colorsys.rgb_to_hsv(fr, fg, fb)
    h, s, v = round(fh * 255), round(fs * 255), round(fv * 255)
    return h, s, v