def build_type(field):
if field.type_id == '<STR_LIT:string>':<EOL><INDENT>if '<STR_LIT:size>' in field.options:<EOL><INDENT>return "<STR_LIT>" % (field.identifier, field.options['<STR_LIT:size>'].value)<EOL><DEDENT>else:<EOL><INDENT>return "<STR_LIT>" % field.identifier<EOL><DEDENT><DEDENT>elif field.type_id in JAVA_TYPE_MAP:<EOL><INDENT>return "<STR_LIT>" % (field.type_id.capitalize(), field.identifier)<EOL><DEDENT>if field.type_id == '<STR_LIT>':<EOL><INDENT>t = field.options['<STR_LIT>'].value<EOL>if t in JAVA_TYPE_MAP:<EOL><INDENT>if '<STR_LIT:size>' in field.options:<EOL><INDENT>return "<STR_LIT>" % (t.capitalize(),<EOL>field.identifier,<EOL>field.options['<STR_LIT:size>'].value)<EOL><DEDENT>else:<EOL><INDENT>return "<STR_LIT>" % (t.capitalize(), field.identifier)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if '<STR_LIT:size>' in field.options:<EOL><INDENT>return "<STR_LIT>" % (field.identifier, field.options['<STR_LIT:size>'].value)<EOL><DEDENT>else:<EOL><INDENT>return "<STR_LIT>" % field.identifier<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>return "<STR_LIT>" % field.identifier<EOL><DEDENT>
Function to pack a type into the binary payload.