def _sanitize_value(value):
    '''Internal helper for converting pythonic values to configuration file values'''
    # dump dict into compated
    if isinstance(value, dict):
        new_value = []
        new_value.append('(')
        for k, v in value.items():
            new_value.append(k)
            new_value.append('=')
            new_value.append(v)
            new_value.append(',')
        new_value.append(')')
        return "".join(six.text_type(v) for v in new_value).replace(',)', ')')
    elif isinstance(value, list):
        new_value = []
        new_value.append('(')
        for item in value:
            if isinstance(item, OrderedDict):
                item = dict(item)
                for k, v in item.items():
                    new_value.append(k)
                    new_value.append('=')
                    new_value.append(v)
            else:
                new_value.append(item)
            new_value.append(',')
        new_value.append(')')
        return "".join(six.text_type(v) for v in new_value).replace(',)', ')')
    else:
        # note: we can't use shelx or pipes quote here because it makes zonecfg barf
        return '"{0}"'.format(value) if ' ' in value else value
Internal helper for converting pythonic values to configuration file values