def format_value(v):
    """
    Formats a value to be included in a string.

    @param      v           a string
    @return                 a string
    """
    return ("'{0}'".format(v.replace("'", "\\'"))
            if isinstance(v, str) else "{0}".format(v))