def _GetScatterProperty(entity_proto):
 hash_obj = _MD5_FUNC()
 for element in entity_proto.key().path().element_list():
  if element.has_name():
   hash_obj.update(element.name())
  elif element.has_id():
   hash_obj.update(str(element.id()))
 hash_bytes = hash_obj.digest()[0:2]
 (hash_int,) = struct.unpack('H', hash_bytes)
 if (hash_int >= _SCATTER_PROPORTION):
  return None
 scatter_property = entity_pb.Property()
 scatter_property.set_name('__scatter__')
 scatter_property.set_meaning(entity_pb.Property.BYTESTRING)
 scatter_property.set_multiple(False)
 property_value = scatter_property.mutable_value()
 property_value.set_stringvalue(hash_bytes)
 return scatter_property

def _GetScatterProperty ( entity_proto ) : hash_obj = _MD5_FUNC ( ) for element in entity_proto . key ( ) . path ( ) . element_list ( ) : if element . has_name ( ) : hash_obj . update ( element . name ( ) ) elif element . has_id ( ) : hash_obj . update ( str ( element . id ( ) ) ) hash_bytes = hash_obj . digest ( ) [ 0 : 2 ] ( hash_int , ) = struct . unpack ( 'H' , hash_bytes ) if ( hash_int >= _SCATTER_PROPORTION ) : return None scatter_property = entity_pb . Property ( ) scatter_property . set_name ( '__scatter__' ) scatter_property . set_meaning ( entity_pb . Property . BYTESTRING ) scatter_property . set_multiple ( False ) property_value = scatter_property . mutable_value ( ) property_value . set_stringvalue ( hash_bytes ) return scatter_property
gets the scatter property for an object .