code: def _safe_append(d, key, val):
      if key not in d:
          d[key] = []
      if val not in d[key]:
          d[key].append(val)
  
imports: import copy
  import functools
  import itertools
  from collections import OrderedDict
  from collections.abc import Iterable
  from typing import List, Dict
  import numpy
  import pandas
  from ...None import opcodes, tensor
  from ...config import options
  from ...core import OutputType, ENTITY_TYPE, enter_mode, recursive_tile
  from ...core.custom_log import redirect_custom_log
  from ...core.operand import OperandStage
  from ...serialization.serializables import BoolField, AnyField, Int32Field, ListField, DictField
  from ...utils import ceildiv, lazy_import, enter_current_session, pd_release_version
  from ..core import INDEX_CHUNK_TYPE
  from ..merge import DataFrameConcat
  from ..operands import DataFrameOperand, DataFrameOperandMixin
  from ..utils import build_df, build_empty_df, build_series, parse_index, validate_axis
  from .core import CustomReduction, ReductionCompiler, ReductionSteps, ReductionAggStep
label_desc: Use image node_id 4 for calling the DataFrameAggregate obj's underlying member method code with example usage: obj._safe_append(d, key, val) without return types