def clean_consecutive_duplicates(
    move_data, subset=None, keep='first', inplace=False
):
    """
    Removes consecutive duplicate rows of the Dataframe, optionally only
    certain columns can be consider.

    Parameters
    ----------
    move_data : dataframe
        The input trajectory data
    subset : Array of Strings, optional, default None(None by default)
        Specifies  Column label or sequence of labels, considered for
        identifying duplicates. By default all columns are used.
    keep : 'first', 'last', optional, default 'first'
        If keep is set as first, all the duplicates except for
        the first occurrence will be dropped.
        On the other hand if set to last, all duplicates except for
        the last occurrence will be dropped.
        If set to False, all duplicates are dropped.
    inplace : boolean, optional, default False
        if set to true the original dataframe will be altered,
        the duplicates will be dropped in place,
        otherwise a copy will be returned.

    Returns
    -------
    dataframe or None
        The filtered trajectories points without consecutive duplicates.

    """

    if keep == 'first':
        n = 1
    else:
        n = -1
    if subset is None:
        filter_ = (move_data.shift(n) != move_data).any(axis=1)
    else:
        filter_ = (move_data[subset].shift(n) != move_data[subset]).any(axis=1)

    return move_data.drop(index=move_data[~filter_].index, inplace=inplace)