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

    index = series.index.to_native_types(quoting=True)
    values = series.values.tolist()

    if ordered:
        return OrderedDict(
            tuple((k, v)) for k, v in zip(index, values))
    else:
        return {i: v for i, v in zip(index, values)}