<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_trace_id_from_webapp2():
 """Get trace_id from webapp2 request headers. :rtype: str :returns: TraceID in HTTP request headers. """

    if webapp2 is None:
        return None

    try:
        # get_request() succeeds if we're in the middle of a webapp2
        # request, or raises an assertion error otherwise:
        # "Request global variable is not set".
        req = webapp2.get_request()
    except AssertionError:
        return None

    header = req.headers.get(_WEBAPP2_TRACE_HEADER)

    if header is None:
        return None

    trace_id = header.split("/", 1)[0]

    return trace_id