<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def frame_to_yaml_safe(frame, ordered=False):
 """ Convert a pandas DataFrame to a dictionary that will survive YAML serialization and re-conversion back to a DataFrame. Parameters frame : pandas.DataFrame ordered: bool, optional, default False If True, an OrderedDict is returned. Returns ------- safe : dict or OrderedDict """

    if ordered:
        return OrderedDict(tuple((col, series_to_yaml_safe(series, True))
                                 for col, series in frame.iteritems()))
    else:
        return {col: series_to_yaml_safe(series)
                for col, series in frame.iteritems()}