@staticmethod
def _quote_encode(literal):
    """
        Copy of code in rdflib here:
        https://github.com/RDFLib/rdflib/blob/776b90be/
        rdflib/plugins/serializers/nt.py#L76
        :param literal:
        :return:
        """
    return '"%s"' % literal.replace('\\', '\\\\').replace('\n', '\\n').replace(
        '"', '\\"').replace('\r', '\\r')
