<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_type(field):
 """ Function to pull a type from the binary payload. """

  if field.type_id == 'string':
    if 'size' in field.options:
      return "parser.getString(%d)" % field.options['size'].value
    else:
      return "parser.getString()"
  elif field.type_id in JAVA_TYPE_MAP:
    # Primitive java types have extractor methods in SBPMessage.Parser
    return "parser.get" + field.type_id.capitalize() + "()"
  if field.type_id == 'array':
    # Call function to build array
    t = field.options['fill'].value
    if t in JAVA_TYPE_MAP:
      if 'size' in field.options:
        return "parser.getArrayof%s(%d)" % (t.capitalize(), field.options['size'].value)
      else:
        return "parser.getArrayof%s()" % t.capitalize()
    else:
      if 'size' in field.options:
        return "parser.getArray(%s.class, %d)" % (t, field.options['size'].value)
      else:
        return "parser.getArray(%s.class)" % t
  else:
    # This is an inner class, call default constructor
    return "new %s().parse(parser)" % field.type_id