def generate_jmespath(text: str, name_contains_array: str) -> str:
    """
    Helper function to generate a bit of jmespath.org code.

    Example:

    ```python
    reference = "contains(labels, 'hi') && contains(labels, 'there')"
    assert generate_jmespath("hi, there", 'labels') == reference

    assert generate_jmespath("hi", 'labels') == "contains(labels, 'hi')"
    ```
    """
    raw_items = text.split(",")
    items = []
    for item in raw_items:
        item = item.strip()
        item = f"contains({name_contains_array}, '{item}')"
        items.append(item)

    return " && ".join(items)