def _rename_indexes(left_df, right_df, lsuffix, rsuffix):
    """
    Helper method for other sjoin methods.
    Renames indexes to numeric for compatibility with rtree.
    Returns renamed DataFrames as well as old indexes and their names.

    Parameters
    ----------
    left_df, right_df : GeoDataFrame
        The geodataframe's being joined.
    lsuffix : string, default 'left'
        Suffix to apply to overlapping column names (left GeoDataFrame).
    rsuffix : string, default 'right'
        Suffix to apply to overlapping column names (right GeoDataFrame).

    Returns
    -------
    left_df, right_df : GeoDataFrame
        The geodataframe's being joined, with indexes renamed.
    index_left : string
        Original index for left_df, to be restored by _join_results.
    index_right : string
        Original index for right_df, to be restored by _join_results
    left_index_name : string
        Original index name for left_df, to be restored by _join_results
    right_index_name : string
        Original index name for right_df, to be restored by _join_results
    """

    # store index names
    index_left = "index_%s" % lsuffix
    index_right = "index_%s" % rsuffix

    # due to GH 352
    if any(left_df.columns.isin([index_left, index_right])) or any(
        right_df.columns.isin([index_left, index_right])
    ):
        raise ValueError(
            "'{0}' and '{1}' cannot be names in the frames being"
            " joined".format(index_left, index_right)
        )

    # the rtree spatial index only allows limited (numeric) index types, but an
    # index in geopandas may be any arbitrary dtype. so reset both indices now
    # and store references to the original indices, to be reaffixed later.
    # GH 352
    left_df = left_df.copy(deep=True)
    try:
        left_index_name = left_df.index.name
        left_df.index = left_df.index.rename(index_left)
    except TypeError:
        index_left = [
            "index_%s" % lsuffix + str(l) for l, ix in enumerate(left_df.index.names)
        ]
        left_index_name = left_df.index.names
        left_df.index = left_df.index.rename(index_left)
    left_df = left_df.reset_index()

    right_df = right_df.copy(deep=True)
    try:
        right_index_name = right_df.index.name
        right_df.index = right_df.index.rename(index_right)
    except TypeError:
        index_right = [
            "index_%s" % rsuffix + str(l) for l, ix in enumerate(right_df.index.names)
        ]
        right_index_name = right_df.index.names
        right_df.index = right_df.index.rename(index_right)
    right_df = right_df.reset_index()

    return left_df, right_df, left_index_name, right_index_name, index_left, index_right