Family 'Part Type' parameter - getting and setting to Project Parameter


I’m new to Dynamo, but I’m giving it a try!
I have managed to get the Part Type parameter from all of the families in my project, using a Python script:

import clr
from Autodesk.DesignScript.Geometry import *
#The inputs to this node will be stored as a list in the IN variables.
fittings = UnwrapElement(IN[0])
listout =

for x in fittings:

#Assign your output to the OUT variable.
OUT = listout

The list works.

However, when it runs it sets the value to the parameter, but the value is wrong. It will set an elbow to be a Tee for example.

How do I get it to work?!

Thanks in anticipation!