code: def _set_k8s_attribute(obj, attribute, value):
      
      current_value = None
      attribute_name = None
      # All k8s python client objects have an 'attribute_map' property
      # which has as keys python style attribute names (api_client)
      # and as values the kubernetes JSON API style attribute names
      # (apiClient). We want to allow users to use the JSON API style attribute
      # names only.
      for python_attribute, json_attribute in obj.attribute_map.items():
          if json_attribute == attribute:
              attribute_name = python_attribute
              break
      else:
          raise ValueError('Attribute must be one of {}'.format(obj.attribute_map.values()))
  
      if hasattr(obj, attribute_name):
          current_value = getattr(obj, attribute_name)
  
      if current_value is not None:
          # This will ensure that current_value is something JSONable,
          # so a dict, list, or scalar
          current_value = SERIALIZATION_API_CLIENT.sanitize_for_serialization(
              current_value
          )
  
      if isinstance(current_value, dict):
          # Deep merge our dictionaries!
          setattr(obj, attribute_name, merge_dictionaries(current_value, value))
      elif isinstance(current_value, list):
          # Just append lists
          setattr(obj, attribute_name, current_value + value)
      else:
          # Replace everything else
          setattr(obj, attribute_name, value)
docs: Set a specific value on a kubernetes object's attribute
  
      obj
          an object from Kubernetes Python API client
      attribute
          Should be a Kubernetes API style attribute (with camelCase)
      value
          Can be anything (string, list, dict, k8s objects) that can be
          accepted by the k8s python client