Does it make sense to check all the elements of `yaml_lines`? What if `yaml_lines` is an empty list?

```python
if [x for x in yaml_lines if not isinstance(x, str)]:
    ...
```