def output_str(f):
    """Create a function that always return instances of `str`.

    This decorator is useful when the returned string is to be used
    with libraries that do not support ̀`unicode` in Python 2, but work
    fine with Python 3 `str` objects.
    """
    if six.PY2:
        #@functools.wraps(f)
        def new_f(*args, **kwargs):
            return f(*args, **kwargs).encode("utf-8")
    else:
        new_f = f
    return new_f
def output_str ( f ) : if six . PY2 : def new_f ( * args , ** kwargs ) : return f ( * args , ** kwargs ) . encode ( "utf-8" ) else : new_f = f return new_f
Create a function that always return instances of `str`.

    This decorator is useful when the returned string is to be used
    with libraries that do not support ̀`unicode` in Python 2, but work
    fine with Python 3 `str` objects.