<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _build_entry(parts, existing_list_d, key_value, key_field_num, key_is_field_number, header=None, output_type=OutputType.error_on_dups, ignore_missing_keys=False, keep_key_col=False):
 """ Build and add an entry to existing_list_d. If the key is a field number, the entry added will be a list of lists. The inner list contains one item per column. and the outer list allows more than one entry to be stored per key (but if allow_duplicates is false, an exception will be raised if more than one needs to be stored). :param parts: the (already tokenized) list of column entries. :param existing_list_d: a dictionary indexed by key value containing the the already processed entries. The new entry will be added to this using <key_value> as a key :param key_value: the key value to use to add the new entry to <existing_list_d> :param key_field_num: which column is the key_value from (number, indexed from 0) :param key_is_field_number: True if the <key_value> is actually the column index, rather than a column name :param header: list giving the names of the columns. Can be None if columns have no names (no header) """

  if key_value.strip() == "":
    if ignore_missing_keys:
      return
    raise MissingKeyError("missing key value")

  if key_value in existing_list_d:
    if output_type is OutputType.error_on_dups:
      raise DuplicateKeyError(key_value + " appears multiple times as key")
    elif (output_type is OutputType.all_pairwise_combinations or
          output_type is OutputType.column_wise_join):
      pass  # dups okay for these output methods
    else:
      raise ValueError("Unknown duplicate handling method")
  else:
    existing_list_d[key_value] = []

  if key_is_field_number:
    # the entry in the dictionary is a list, minus the key field, in the
    # order they occur.
    ne = [parts[i] for i in range(0, len(parts))
          if i != key_field_num or keep_key_col]
    existing_list_d[key_value].append(ne)
  else:
    # the entry in the dictionary is another dictionary indexed by
    # the header value
    ne = {}
    for i in range(0, len(parts)):
      if i == key_field_num and not keep_key_col:
        continue
      else:
        ne[header[i]] = parts[i]
    existing_list_d[key_value].append(ne)