Gas line question

Found this along the gas piping in this home. Any ideas what this is for? My fist guess is the Harry the home owner extended the pipe with a T-junction he had laying around and capped it with a PVC pipe…Thanks ahead of time

Looks like he started to install some gas logs or something and gave up.
Looks real scary to me.

I doubt if PVC is an approved method of gas distribution.

PVC is not approved

YEP…I got this one…One of our great Northern California home inspectors that charge 195.00 for an inspection told this guy he needed a drip leg on the gas line.