'Hex encodes some characters for use in JavaScript strings.
Lightly inspired from https://github.com/django/django/blame/ebc773ada3e4f40cf5084268387b873d7fe22e8b/django/utils/html.py#L63'

def _escapejs(self, value):

    for (bad, good) in self._JS_ESCAPES:
        value = value.replace(bad, good)
    return self._safe(value)
