'Given a value of this type, produce a Unicode string
representing the value. This is used in template evaluation.'

def format(self, value):

    if (value is None):
        value = self.null
    if (value is None):
        value = u''
    if isinstance(value, bytes):
        value = value.decode('utf-8', 'ignore')
    return six.text_type(value)
