Convert data into a vertex data sframe. Using vid_field to identify the id
    column. The returned sframe will have id column name '__id'.

def _vertex_data_to_sframe(data, vid_field):
    """
    Convert data into a vertex data sframe. Using vid_field to identify the id
    column. The returned sframe will have id column name '__id'.
    """
    if isinstance(data, SFrame):
        # '__id' already in the sframe, and it is ok to not specify vid_field
        if vid_field is None and _VID_COLUMN in data.column_names():
            return data
        if vid_field is None:
            raise ValueError("vid_field must be specified for SFrame input")
        data_copy = copy.copy(data)
        data_copy.rename({vid_field: _VID_COLUMN}, inplace=True)
        return data_copy

    if type(data) == Vertex or type(data) == list:
        return _vertex_list_to_sframe(data, '__id')

    elif HAS_PANDAS and type(data) == pd.DataFrame:
        if vid_field is None:
            # using the dataframe index as vertex id
            if data.index.is_unique:
                if not ("index" in data.columns):
                    # pandas reset_index() will insert a new column of name "index".
                    sf = SFrame(data.reset_index())  # "index"
                    sf.rename({'index': _VID_COLUMN}, inplace=True)
                    return sf
                else:
                    # pandas reset_index() will insert a new column of name "level_0" if there exists a column named "index".
                    sf = SFrame(data.reset_index())  # "level_0"
                    sf.rename({'level_0': _VID_COLUMN}, inplace=True)
                    return sf
            else:
                raise ValueError("Index of the vertices dataframe is not unique, \
                        try specifying vid_field name to use a column for vertex ids.")
        else:
            sf = SFrame(data)
            if _VID_COLUMN in sf.column_names():
                raise ValueError('%s reserved vid column name already exists in the SFrame' % _VID_COLUMN)
            sf.rename({vid_field: _VID_COLUMN}, inplace=True)
            return sf
    else:
        raise TypeError('Vertices type %s is Not supported.' % str(type(data)))