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

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