<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_type(f, type_map=CONSTRUCT_CODE):
 """ Format a the proper type. """

  name = f.type_id
  if name.startswith('GPSTime'):
    name = 'Gps' + name[3:]
  if type_map.get(name, None):
    return type_map.get(name, None)
  elif name == 'array':
    fill = f.options['fill'].value
    f_ = copy.copy(f)
    f_.type_id = fill
    return "[%s]" % to_type(f_)
  return name