<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def eeg_to_df(eeg, index=None, include="all", exclude=None, hemisphere="both", central=True):
 """ Convert mne Raw or Epochs object to dataframe or dict of dataframes. DOCS INCOMPLETE :( """

    if isinstance(eeg, mne.Epochs):
        data = {}

        if index is None:
            index = range(len(eeg))

        for epoch_index, epoch in zip(index, eeg.get_data()):

            epoch = pd.DataFrame(epoch.T)
            epoch.columns = eeg.ch_names
            epoch.index = eeg.times

            selection = eeg_select_electrodes(eeg, include=include, exclude=exclude, hemisphere=hemisphere, central=central)

            data[epoch_index] = epoch[selection]

    else:  # it might be a Raw object
        data = eeg.get_data().T
        data = pd.DataFrame(data)
        data.columns = eeg.ch_names
        data.index = eeg.times

    return(data)