<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_zipkin_attr(request):
 """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` """

    settings = request.registry.settings

    if 'zipkin.is_tracing' in settings:
        is_sampled = settings['zipkin.is_tracing'](request)
    else:
        is_sampled = is_tracing(request)

    request.zipkin_trace_id = get_trace_id(request)

    span_id = request.headers.get(
        'X-B3-SpanId', generate_random_64bit_string())
    parent_span_id = request.headers.get('X-B3-ParentSpanId', None)
    flags = request.headers.get('X-B3-Flags', '0')
    return ZipkinAttrs(
        trace_id=request.zipkin_trace_id,
        span_id=span_id,
        parent_span_id=parent_span_id,
        flags=flags,
        is_sampled=is_sampled,
    )