Encode zfs safe string (used for name, path, ...)

def to_str(value):
    '''
    Encode zfs safe string (used for name, path, ...)
    '''
    value = from_str(value)

    if value:
        value = value.replace('"', '\\"')
        if ' ' in value:
            value = '"' + value + '"'
    elif value is None:
        value = 'none'

    return value