def URLSerializer(original, context):
    def _maybeEncode(s):
        if isinstance(s, unicode):
            s = s.encode('utf-8')
        return s
    urlContext = WovenContext(parent=context, precompile=context.precompile, inURL=True)
    if original.scheme:
        # TODO: handle Unicode (see #2409)
        yield "%s://%s" % (original.scheme, original.netloc)
    for pathsegment in original._qpathlist:
        yield '/'
        yield serialize(_maybeEncode(pathsegment), urlContext)
    query = original._querylist
    if query:
        yield '?'
        first = True
        for key, value in query:
            if not first:
                # xhtml can't handle unescaped '&'
                if context.isAttrib is True:
                    yield '&amp;'
                else:
                    yield '&'
            else:
                first = False
            yield serialize(_maybeEncode(key), urlContext)
            if value is not None:
                yield '='
                yield serialize(_maybeEncode(value), urlContext)
    if original.fragment:
        yield "#"
        yield serialize(_maybeEncode(original.fragment), urlContext)
Return a new :class:`.Query` object with the specified "locking mode",
dataset/ETHPy150Open twisted/nevow/nevow/url.py/URLSerializer--crossover with--dataset/ETHPy150Open goFrendiAsgard/kokoropy/kokoropy/packages/sqlalchemy/orm/query.py/Query.with_lockmode