def rotate_jump_code(jumpcode, rotation):
    """
    From a given jumpcode, and a pitch rotation (0 -> 11)
    return a new jumpcode
    """
    assert rotation >= 0 and rotation < 12
    if rotation == 0:
        return jumpcode
    original_offset = jumpcode % 12
    new_offset = (original_offset + rotation) % 12
    return jumpcode - original_offset + new_offset