'Returns the given value as a string (empty string for None).'

def _encode(self, v, indent=''):

    v = ('%s' % (v if (v is not None) else ''))
    v = (v.replace('\n', ('\n' + indent)) if indent else v)
    return v
