code: def to_dict(self):
      data = {
          "name": self.name,
          "action": {"type": "Keep"},
          "condition": {"tagState": self.tag_state},
      }
      condition = data["condition"]
      if self.tag_prefixes is not None:
          condition["tagPrefixes"] = self.tag_prefixes
      if self.version_name_prefixes is not None:
          condition["versionNamePrefixes"] = self.version_name_prefixes
      if self.package_name_prefixes is not None:
          condition["packageNamePrefixes"] = self.package_name_prefixes
      if self.older_than:
          condition["olderThan"] = self.older_than
      if self.newer_than:
          condition["newerThan"] = self.newer_than
      return data
  
imports: import abc
  import json
  import yaml
  from typing import List, Optional
label_desc: Use image node_id 2 for calling the ConditionalKeepPolicy obj's underlying member method code with example usage: obj.to_dict() and returns: data