def METHOD_NAME(
    spike_train: np.ndarray, censored_period: int, seed: Optional[int] = None, method: str = "keep_first"
) -> np.ndarray:
    (indices_of_duplicates,) = np.where(np.diff(spike_train) <= censored_period)
    if method == "keep_first":
        indices_of_duplicates += 1
    elif method == "random":
        rand_state = np.random.get_state()
        np.random.seed(seed)
        mask = np.ones(len(spike_train), dtype=bool)
        while np.sum(np.diff(spike_train[mask]) <= censored_period) > 0:
            shift = np.random.randint(low=0, high=2, size=len(indices_of_duplicates))
            mask[indices_of_duplicates + shift] = False
        np.random.set_state(rand_state)
        (indices_of_duplicates,) = np.where(~mask)
    elif method != "keep_last":
        raise ValueError(f"Method '{method}' isn't a valid method for _find_duplicated_spikes_numpy.")
    return indices_of_duplicates