def axis_for_letter(letter):
    """Returns 0, 1 or 2 for 'K', 'J', or 'I'; as required for axis arguments in FineCoarse methods."""

    assert isinstance(letter, str) and len(letter) == 1
    u = letter.upper()
    return 'KJI'.index(u)