def is_scalar_key(key: Any, ndim: int) -> bool:
    """
    Whether the input is something like a key for accessing a "single" item
    from an array. i.e. a single scalar, or a tuple of all scalars.

    Args:
        key (Any):
            the key to check

        ndim (int):
            the number of expected dimensions for the key

    Returns
        True if the key is a scalar key, otherwise False

    """
    if np.isscalar(key) and ndim == 1:
        return True

    if (
        isinstance(key, tuple)
        and len(key) == ndim
        and all(np.isscalar(x) for x in key)
    ):
        return True

    return False

    Whether the input is something like a key for accessing a "single" item
    from an array. i.e. a single scalar, or a tuple of all scalars.

    Args:
        key (Any):
            the key to check

        ndim (int):
            the number of expected dimensions for the key

    Returns
        True if the key is a scalar key, otherwise False

    
cupynumeric/_array/doctor.py