Serialize Python data to a Python string representation (via pprint.format)

    :param obj: the data structure to serialize
    :param options: options given to pprint.format

def serialize(obj, **options):
    '''
    Serialize Python data to a Python string representation (via pprint.format)

    :param obj: the data structure to serialize
    :param options: options given to pprint.format
    '''

    #round-trip this through JSON to avoid OrderedDict types
    # there's probably a more performant way to do this...
    # TODO remove json round-trip when all dataset will use
    # serializers
    return pprint.pformat(
        salt.utils.json.loads(
            salt.utils.json.dumps(obj, _json_module=_json),
            _json_module=_json
        ),
        **options
    )