<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def unit_type(scale=None):
 """Returns a palette that maps unit types to rgb colors."""

  # Can specify a scale to match the api or to accept unknown unit types.
  palette_size = scale or max(static_data.UNIT_TYPES) + 1
  palette = shuffled_hue(palette_size)
  assert len(static_data.UNIT_TYPES) <= len(distinct_colors)
  for i, v in enumerate(static_data.UNIT_TYPES):
    palette[v] = distinct_colors[i]
  return palette