<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_rows(data, nrows, starting_index=None, accounting_column=None):
 """ Add rows to data table according to a given nrows. New rows will have their IDs set to NaN. Parameters data : pandas.DataFrame nrows : int Number of rows to add. starting_index : int, optional The starting index from which to calculate indexes for the new rows. If not given the max + 1 of the index of `data` will be used. accounting_column: string, optional Name of column with accounting totals/quanties to apply towards the control. If not provided then row counts will be used for accounting. Returns ------- updated : pandas.DataFrame Table with rows added. New rows will have their index values set to NaN. added : pandas.Index New indexes of the rows that were added. copied : pandas.Index Indexes of rows that were copied. A row copied multiple times will have multiple entries. """

    logger.debug('start: adding {} rows in transition model'.format(nrows))
    if nrows == 0:
        return data, _empty_index(), _empty_index()

    if not starting_index:
        starting_index = data.index.values.max() + 1

    new_rows = sample_rows(nrows, data, accounting_column=accounting_column)
    copied_index = new_rows.index
    added_index = pd.Index(np.arange(
        starting_index, starting_index + len(new_rows.index), dtype=np.int))
    new_rows.index = added_index

    logger.debug(
        'finish: added {} rows in transition model'.format(len(new_rows)))
    return pd.concat([data, new_rows]), added_index, copied_index