Plots an item frequency of the sarray provided as input, and returns the 
    resulting Plot object.
    
    The function supports SArrays with dtype str.

    Parameters
    ----------
    sa : SArray
      The data to get an item frequency for. Must have dtype str
    xlabel : str (optional)
      The text label for the X axis. Defaults to "Values".
    ylabel : str (optional)
      The text label for the Y axis. Defaults to "Count".
    title : str (optional)
      The title of the plot. Defaults to LABEL_DEFAULT. If the value is
      LABEL_DEFAULT, the title will be "<xlabel> vs. <ylabel>". If the value
      is None, the title will be omitted. Otherwise, the string passed in as the
      title will be used as the plot title.
    
    Returns
    -------
    out : Plot
      A :class: Plot object that is the item frequency plot.

    Examples
    --------
    Make an item frequency of an SArray.

    >>> x = turicreate.SArray(['a','ab','acd','ab','a','a','a','ab','cd'])
    >>> ifplt = turicreate.visualization.item_frequency(x)

def item_frequency(sa, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
    """
    Plots an item frequency of the sarray provided as input, and returns the 
    resulting Plot object.
    
    The function supports SArrays with dtype str.

    Parameters
    ----------
    sa : SArray
      The data to get an item frequency for. Must have dtype str
    xlabel : str (optional)
      The text label for the X axis. Defaults to "Values".
    ylabel : str (optional)
      The text label for the Y axis. Defaults to "Count".
    title : str (optional)
      The title of the plot. Defaults to LABEL_DEFAULT. If the value is
      LABEL_DEFAULT, the title will be "<xlabel> vs. <ylabel>". If the value
      is None, the title will be omitted. Otherwise, the string passed in as the
      title will be used as the plot title.
    
    Returns
    -------
    out : Plot
      A :class: Plot object that is the item frequency plot.

    Examples
    --------
    Make an item frequency of an SArray.

    >>> x = turicreate.SArray(['a','ab','acd','ab','a','a','a','ab','cd'])
    >>> ifplt = turicreate.visualization.item_frequency(x)
    """
    if (not isinstance(sa, tc.data_structures.sarray.SArray) or
        sa.dtype != str):
        raise ValueError("turicreate.visualization.item_frequency supports " + 
            "SArrays of dtype str")
    title = _get_title(title)
    plt_ref = tc.extensions.plot_item_frequency(sa, 
      xlabel, ylabel, title)
    return Plot(plt_ref)