def ToPropertyPb(name, values):
 encoded_name = name.encode('utf-8')
 values_type = type(values)
 if (values_type is list):
  multiple = True
 else:
  multiple = False
  values = [values]
 pbs = []
 for v in values:
  pb = entity_pb.Property()
  pb.set_name(encoded_name)
  pb.set_multiple(multiple)
  meaning = _PROPERTY_MEANINGS.get(v.__class__)
  if (meaning is not None):
   pb.set_meaning(meaning)
  pack_prop = _PACK_PROPERTY_VALUES[v.__class__]
  pbvalue = pack_prop(name, v, pb.mutable_value())
  pbs.append(pb)
 if multiple:
  return pbs
 else:
  return pbs[0]

def ToPropertyPb ( name , values ) : encoded_name = name . encode ( 'utf-8' ) values_type = type ( values ) if ( values_type is list ) : multiple = True else : multiple = False values = [ values ] pbs = [ ] for v in values : pb = entity_pb . Property ( ) pb . set_name ( encoded_name ) pb . set_multiple ( multiple ) meaning = _PROPERTY_MEANINGS . get ( v . __class__ ) if ( meaning is not None ) : pb . set_meaning ( meaning ) pack_prop = _PACK_PROPERTY_VALUES [ v . __class__ ] pbvalue = pack_prop ( name , v , pb . mutable_value ( ) ) pbs . append ( pb ) if multiple : return pbs else : return pbs [ 0 ]
creates type-specific entity_pb .