def create_zipkin_attr(request):
settings = request.registry.settings<EOL>if '<STR_LIT>' in settings:<EOL><INDENT>is_sampled = settings['<STR_LIT>'](request)<EOL><DEDENT>else:<EOL><INDENT>is_sampled = is_tracing(request)<EOL><DEDENT>request.zipkin_trace_id = get_trace_id(request)<EOL>span_id = request.headers.get(<EOL>'<STR_LIT>', generate_random_64bit_string())<EOL>parent_span_id = request.headers.get('<STR_LIT>', None)<EOL>flags = request.headers.get('<STR_LIT>', '<STR_LIT:0>')<EOL>return ZipkinAttrs(<EOL>trace_id=request.zipkin_trace_id,<EOL>span_id=span_id,<EOL>parent_span_id=parent_span_id,<EOL>flags=flags,<EOL>is_sampled=is_sampled,<EOL>)<EOL>
Create ZipkinAttrs object from a request with sampled flag as True.
    Attaches lazy attribute `zipkin_trace_id` with request which is then used
    throughout the tween.

    Consumes custom is_tracing function to determine if the request is traced
    if one is set in the pyramid registry.

    :param request: pyramid request object
    :rtype: :class:`pyramid_zipkin.request_helper.ZipkinAttrs`