def METHOD_NAME(u):
    """
    An html escape function that behaves the same in both Python 2 and 3.
    This function is needed because single quotes are escaped in Python 3
    (to '&#x27;'), but not in Python 2.
    The global defaults.TAG_ESCAPE can be set to this function in the
    setUp() and tearDown() of unittest test cases, for example, for
    consistent test results.
    """
    u = _DEFAULT_TAG_ESCAPE(u)
    return u.replace("'", '&#x27;')