def literalize_string(content, is_unicode=False):
    """Literalize a string content.

    Examples:

    >>> print literalize_string('str')
    'str'
    >>> print literalize_string('\\'str\\'')
    "'str'"
    >>> print literalize_string('\\"\\'str\\'\\"')
    '"\\'str\\'"'
    """
    quote_mark = "'"
    if "'" in content:
        quote_mark = '"'
        if '"' in content:
            quote_mark = "'"
            content = content.replace("'", "\\'")
    if '\n' in content:
        quote_mark *= 3
    return 'u'[not is_unicode:] + quote_mark + content + quote_mark
