def _test_for_objects(data):
    """
    Raise an exception if any of the columns have 'O' dtype.

    This is necessary because the 'O' dtype has an undefined size and cannot
    be scattered/gathered via MPI.
    """
    for col in data.colnames:
        if data.dtype[col] == 'O':
            raise TypeError(
                "column '%s' is of type 'O'; must convert to integer or string"
                 % col)
    return data
