<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _value_needs_quotes(val):
 """Return valid quotes for the given value, or None if unneeded."""

        if not val:
            return None
        val = "".join(str(node) for node in val.filter_text(recursive=False))
        if not any(char.isspace() for char in val):
            return None
        if "'" in val and '"' not in val:
            return '"'
        if '"' in val and "'" not in val:
            return "'"
        return "\"'"