Return a bytestring representation of the value

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