Finds the only column in `SFrame` with a type specified by `target_type`.
    If there are zero or more than one such columns, an exception will be
    raised. The name and type of the target column should be provided as
    strings for the purpose of error feedback.

def _find_only_column_of_type(sframe, target_type, type_name, col_name):
    """
    Finds the only column in `SFrame` with a type specified by `target_type`.
    If there are zero or more than one such columns, an exception will be
    raised. The name and type of the target column should be provided as
    strings for the purpose of error feedback.
    """
    image_column_name = None
    if type(target_type) != list:
        target_type = [target_type]
    for name, ctype in zip(sframe.column_names(), sframe.column_types()):
        if ctype in target_type:
            if image_column_name is not None:
                raise ToolkitError('No "{col_name}" column specified and more than one {type_name} column in "dataset". Can not infer correct {col_name} column.'.format(col_name=col_name, type_name=type_name))
            image_column_name = name
    if image_column_name is None:
        raise ToolkitError('No %s column in "dataset".' % type_name)
    return image_column_name