def encode(self, value):
    'Return a bytestring representation of the value'
    if isinstance(value, Token):
        return b(value.value)
    elif isinstance(value, bytes):
        return value
    elif isinstance(value, (int, long)):
        value = b(str(value))
    elif isinstance(value, float):
        value = b(repr(value))
    elif (not isinstance(value, basestring)):
        value = str(value)
    if isinstance(value, unicode):
        value = value.encode(self.encoding, self.encoding_errors)
    return value
Return a bytestring representation of the value
def encode(self, value):
    
    if isinstance(value, Token):
        return b(value.value)
    elif isinstance(value, bytes):
        return value
    elif isinstance(value, (int, long)):
        value = b(str(value))
    elif isinstance(value, float):
        value = b(repr(value))
    elif (not isinstance(value, basestring)):
        value = str(value)
    if isinstance(value, unicode):
        value = value.encode(self.encoding, self.encoding_errors)
    return value