def MessageSizer(field_number, is_repeated, is_packed):
 tag_size = _TagSize(field_number)
 local_VarintSize = _VarintSize
 assert (not is_packed)
 if is_repeated:
  def RepeatedFieldSize(value):
   result = (tag_size * len(value))
   for element in value:
    l = element.ByteSize()
    result += (local_VarintSize(l) + l)
   return result
  return RepeatedFieldSize
 else:
  def FieldSize(value):
   l = value.ByteSize()
   return ((tag_size + local_VarintSize(l)) + l)
  return FieldSize

def MessageSizer ( field_number , is_repeated , is_packed ) : tag_size = _TagSize ( field_number ) local_VarintSize = _VarintSize assert ( not is_packed ) if is_repeated : def RepeatedFieldSize ( value ) : result = ( tag_size * len ( value ) ) for element in value : l = element . ByteSize ( ) result += ( local_VarintSize ( l ) + l ) return result return RepeatedFieldSize else : def FieldSize ( value ) : l = value . ByteSize ( ) return ( ( tag_size + local_VarintSize ( l ) ) + l ) return FieldSize
returns a sizer for a message field .