def caching_wire_encode(obj):
 result = _wire_encode_cache.get(obj)
 if (result is None):
  result = wire_encode(obj)
  _wire_encode_cache.put(obj, result)
 return result

def caching_wire_encode ( obj ) : result = _wire_encode_cache . get ( obj ) if ( result is None ) : result = wire_encode ( obj ) _wire_encode_cache . put ( obj , result ) return result
encode an object to bytes using wire_encode and cache the result .