def wrapstr(space, s):
    from pypy.objspace.std.stringobject import W_StringObject
    from pypy.objspace.std.ropeobject import rope, W_RopeObject
    if space.config.objspace.std.sharesmallstr:
        if space.config.objspace.std.withprebuiltchar:
            if (len(s) <= 1):
                if (len(s) == 0):
                    if space.config.objspace.std.withrope:
                        return W_RopeObject.EMPTY
                    return W_StringObject.EMPTY
                else:
                    s = s[0]
                    return wrapchar(space, s)
        elif (len(s) == 0):
            if space.config.objspace.std.withrope:
                return W_RopeObject.EMPTY
            return W_StringObject.EMPTY
    if space.config.objspace.std.withrope:
        return W_RopeObject(rope.LiteralStringNode(s))
    return W_StringObject(s)
def wrapstr(space, s):
    from pypy.objspace.std.stringobject import W_StringObject
    from pypy.objspace.std.ropeobject import rope, W_RopeObject
    if space.config.objspace.std.sharesmallstr:
        if space.config.objspace.std.withprebuiltchar:
            if (len(s) <= 1):
                if (len(s) == 0):
                    if space.config.objspace.std.withrope:
                        return W_RopeObject.EMPTY
                    return W_StringObject.EMPTY
                else:
                    s = s[0]
                    return wrapchar(space, s)
        elif (len(s) == 0):
            if space.config.objspace.std.withrope:
                return W_RopeObject.EMPTY
            return W_StringObject.EMPTY
    if space.config.objspace.std.withrope:
        return W_RopeObject(rope.LiteralStringNode(s))
    return W_StringObject(s)