nebius/SWE-bench-extra huggingface dataset:
Repository: xarg/kuku

Issue:
Feature request: ability to enable/disable whole K8s resource
I want to do something like this:
```python
def template(context):
    if not context["deployment"]["enabled"]:
        return

    context_name = context["name"]
    labels = {"app": context_name}
    ...
```
This fails with 
```
Traceback (most recent call last):
  File ".../bin/kuku", line 10, in <module>
    sys.exit(cli())
  File ".../kuku/cli.py", line 59, in cli
    output = dump(rendering)
  File ".../kuku/dump.py", line 54, in dump
    "Template '{}' returned {} object".format(template_path, k8s_object)
ValueError: Template 'deployment/k8s/templates/cronjob.py' returned None object
```

I am going to submit a PR that is going to skip the serialization/dumping of the `k8s_object` if it's `None`

Comments:

Patch:
diff --git a/kuku/dump.py b/kuku/dump.py
index b9366c0..614fec6 100644
--- a/kuku/dump.py
+++ b/kuku/dump.py
@@ -48,11 +48,13 @@ def dump(rendering: Rendering) -> str:
         template_output = []
         template_header = "# Source: {}\n".format(template_path)
         for k8s_object in k8s_objects:
-            # Override the default to_dict method so we can update the k8s keys
             if not k8s_object:
+                if k8s_object is None:
+                    continue
                 raise ValueError(
                     "Template '{}' returned {} object".format(template_path, k8s_object)
                 )
+            # Override the default to_dict method so we can update the k8s keys
             k8s_object.to_dict = MethodType(_camelized_to_dict, k8s_object)
             k8s_object = k8s_object.to_dict()
 


Test patch:
diff --git a/kuku/tests/test_dump.py b/kuku/tests/test_dump.py
index e69de29..0ccafa8 100644
--- a/kuku/tests/test_dump.py
+++ b/kuku/tests/test_dump.py
@@ -0,0 +1,6 @@
+from kuku.dump import dump
+
+
+def test_dump_with_none_object():
+    output = dump({"dir1": [None, ]})
+    assert output == "# Source: dir1\n"