def escape_any(value):
    """
    Section 4.1.2 defines SPARQL shortened forms
    https://www.w3.org/TR/2013/REC-sparql11-query-20130321/#QSynLiterals

    Examples of literal syntax in SPARQL include:

        "chat"
        'chat'@fr with language tag "fr"
        "xyz"^^<http://example.org/ns/userDatatype>
        "abc"^^appNS:appDataType
        '''The librarian said, "Perhaps you would enjoy 'War and Peace'."'''
        1, which is the same as "1"^^xsd:integer
        1.3, which is the same as "1.3"^^xsd:decimal
        1.300, which is the same as "1.300"^^xsd:decimal
        1.0e6, which is the same as "1.0e6"^^xsd:double
        true, which is the same as "true"^^xsd:boolean
        false, which is the same as "false"^^xsd:boolean
    """
    if isinstance(value, type):
        raise TypeError("object %r is not an instance" % value)
    for type_, escape_method in escapers:
        if isinstance(value, type_):
            return escape_method(value)
    return escape_string(str(value))