def _responseFromMessage(responseConstructor, message, **kwargs):
    """
    Generate a L{Message} like instance suitable for use as the response to
    C{message}.

    The C{queries}, C{id} attributes will be copied from C{message} and the
    C{answer} flag will be set to L{True}.

    @param responseConstructor: A response message constructor with an
         initializer signature matching L{dns.Message.__init__}.
    @type responseConstructor: C{callable}

    @param message: A request message.
    @type message: L{Message}

    @param kwargs: Keyword arguments which will be passed to the initialiser
        of the response message.
    @type kwargs: L{dict}

    @return: A L{Message} like response instance.
    @rtype: C{responseConstructor}
    """
    response = responseConstructor(id=message.id, answer=True, **kwargs)
    response.queries = message.queries[:]
    return response

    Generate a L{Message} like instance suitable for use as the response to
    C{message}.

    The C{queries}, C{id} attributes will be copied from C{message} and the
    C{answer} flag will be set to L{True}.

    @param responseConstructor: A response message constructor with an
         initializer signature matching L{dns.Message.__init__}.
    @type responseConstructor: C{callable}

    @param message: A request message.
    @type message: L{Message}

    @param kwargs: Keyword arguments which will be passed to the initialiser
        of the response message.
    @type kwargs: L{dict}

    @return: A L{Message} like response instance.
    @rtype: C{responseConstructor}
    
stackoverflow/venv/lib/python3.6/site-packages/twisted/names/dns.py