code: def frame_to_yaml_safe(frame, ordered=False):
      
      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()}
docs: 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