<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dir_df_boot(dir_df, nb=5000, par=False):
 """ Performs a bootstrap for direction DataFrame with optional parametric bootstrap Parameters _________ dir_df : Pandas DataFrame with columns: dir_dec : mean declination dir_inc : mean inclination Required for parametric bootstrap dir_n : number of data points in mean dir_k : Fisher k statistic for mean nb : number of bootstraps, default is 5000 par : if True, do a parameteric bootstrap Returns _______ BDIs: nested list of bootstrapped mean Dec,Inc pairs """

    N = dir_df.dir_dec.values.shape[0]  # number of data points
    BDIs = []
    for k in range(nb):
        pdir_df = dir_df.sample(n=N, replace=True)  # bootstrap pseudosample
        pdir_df.reset_index(inplace=True)  # reset the index
        if par:  # do a parametric bootstrap
            for i in pdir_df.index:  # set through the pseudosample
                n = pdir_df.loc[i, 'dir_n']  # get number of samples/site
                # get ks for each sample
                ks = np.ones(shape=n)*pdir_df.loc[i, 'dir_k']
                # draw a fisher distributed set of directions
                decs, incs = fshdev(ks)
                di_block = np.column_stack((decs, incs))
                #  rotate them to the mean
                di_block = dodirot_V(
                    di_block, pdir_df.loc[i, 'dir_dec'], pdir_df.loc[i, 'dir_inc'])
                # get the new mean direction for the pseudosample
                fpars = fisher_mean(di_block)
                # replace the pseudo sample mean direction
                pdir_df.loc[i, 'dir_dec'] = fpars['dec']
                pdir_df.loc[i, 'dir_inc'] = fpars['inc']
        # get bootstrap mean bootstrap sample
        bfpars = dir_df_fisher_mean(pdir_df)
        BDIs.append([bfpars['dec'], bfpars['inc']])
    return BDIs