<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def linebreaks_safe(value, autoescape=True):
 """ Adds linebreaks only for text that has a newline character. """

    if isinstance(value, string_types) and '\n' in value:
        return linebreaks_filter(value, autoescape=autoescape)

    return value