set EnumType instance values to None for empty elements

Working with a wsdl that specifies something like:

    <xsd:simpleType name="ToppingType">
      <xsd:restriction base="xsd:string">
        <xsd:enumeration value="PEPPERONI"/>
        <xsd:enumeration value="SAUSAGE"/>
      </xsd:restriction>
    </xsd:simpleType>
    ...
    <xsd:complexType name="Pizza">
      <xsd:sequence>
          <xsd:element minOccurs="0" name="topping" nillable="true" type="t2:ToppingType"/>
          ...
      </xsd:sequence>
    </xsd:complexType>

Where the service returns something like this:

    <typ:pizza>
      <typ:topping xsi:nil="true"/>
    </typ:pizza>

Resulting in an error:

        elif ' ' in val:
    TypeError: argument of type 'NoneType' is not iterable

What I've done here seems pretty naive; there's no check to see whether the element has the nil="true" attribute value, and it's just assumed that val ends up being None because the element looks like <x nil="true"/>. So, open to suggestions on a better implementation.