code: def format_value(self, val):
          
          if isinstance(val, six.text_type):
              return self.format_string(val)
          else:
              return six.text_type(val)
docs: Helper function to format a value.