def METHOD_NAME(
    cursor, valid_length, sidx, factor, sidx_loss_in, sidx_loss_out,
    event_item_in, event_item_out, plafactors, items_amps
):
    """
    Cycle through data in input buffer. Call functions to extract event IDs,
    item IDs, sample IDs (sidx) and losses. Call functions to write event IDs,
    items IDs, sidx and Post Loss Amplification (PLA) losses to output buffer.
    Args:
        cursor (int): position in buffer
        valid_length (int): length of buffer as a multiple of DATA_SIZE
        sidx (int): sample ID
        factor (float): PLA factor
        sidx_loss_in (numpy.ndarray): input array of sidx-loss pairs
        sidx_loss_out (numpy.ndarray): output array of sidx-loss pairs
        event_item_in (numpy.ndarray): input array of event ID-item ID pairs
        event_item_out (numpy.ndarray): output array of event ID-item ID pairs
        plafactors (numba.typed.typeddict.Dict): PLA factors dictionary mapped
            to event ID-item ID pair
        items_amps (numpy.ndarray): array of amplification IDs, where index
            corresponds to item ID
    Returns:
        cursor (int): position in buffer
        sidx (int): sample ID
        factor (float): PLA factor
    """
    while cursor < valid_length:
        if sidx != 0:   # end of samples
            cursor, sidx = read_and_write_sidx_loss(
                cursor, factor, sidx_loss_in, sidx_loss_out
            )
        else:
            cursor, sidx, factor = read_and_write_event_item_ids_and_plafactor(
                cursor, event_item_in, event_item_out, plafactors, items_amps
            )
    return cursor, sidx, factor