The Partner WSDL defines result element not defined in the "SObject"
    section of the Partner WSDL as <any/> elements, which get unmarshalled by
    suds into single-element lists.  We prefer that they are strings, so we'll 
    convert structures like

[(records){
   type = "Contact"
   Id = "003000000000000000"
   Account[] = 
      (Account){
         type = "Account"
         Id = "001000000000000000"
         Name[] = 
            "Acme",
      },
   FirstName[] = 
      "Wile E.",
   LastName[] = 
      "Coyote",
 }]

    to

[(records){
   type = "Contact"
   Id = "003000000000000000"
   Account = 
      (Account){
         type = "Account"
         Id = "001000000000000000"
         Name = "Acme"
      }
   FirstName = "Wile E."
   LastName = "Coyote"
 }]

    and

searchRecords[] = 
      (searchRecords){
         record = 
            (record){
               type = "Lead"
               Id = None
               Name[] = 
                  "Single User",
               Phone[] = 
                  "(617) 555-1212",
            }
      },

    to

searchRecords[] = 
      (searchRecords){
         record = 
            (record){
               type = "Lead"
               Id = None
               Name = "Single User",
               Phone = "(617) 555-1212",
            }
      },

def _stringifyResultRecords(self, struct):
    '''
    The Partner WSDL defines result element not defined in the "SObject"
    section of the Partner WSDL as <any/> elements, which get unmarshalled by
    suds into single-element lists.  We prefer that they are strings, so we'll 
    convert structures like

[(records){
   type = "Contact"
   Id = "003000000000000000"
   Account[] = 
      (Account){
         type = "Account"
         Id = "001000000000000000"
         Name[] = 
            "Acme",
      },
   FirstName[] = 
      "Wile E.",
   LastName[] = 
      "Coyote",
 }]

    to

[(records){
   type = "Contact"
   Id = "003000000000000000"
   Account = 
      (Account){
         type = "Account"
         Id = "001000000000000000"
         Name = "Acme"
      }
   FirstName = "Wile E."
   LastName = "Coyote"
 }]

    and

searchRecords[] = 
      (searchRecords){
         record = 
            (record){
               type = "Lead"
               Id = None
               Name[] = 
                  "Single User",
               Phone[] = 
                  "(617) 555-1212",
            }
      },

    to

searchRecords[] = 
      (searchRecords){
         record = 
            (record){
               type = "Lead"
               Id = None
               Name = "Single User",
               Phone = "(617) 555-1212",
            }
      },
    '''
    if not isinstance(struct, list):
      struct = [struct]
      originallyList = False
    else:
      originallyList = True

    for record in struct:
      for k, v in record:
        if isinstance(v, list):
          # At this point, we don't know whether a value of [] corresponds to '' or None
          # However, anecdotally I've been unable to find a field type whose 'empty' value
          # returns anything other that <sf:FieldNameHere xsi:nil="true"/>
          # so, for now, we'll set it to None
          if v == []:
            setattr(record, k, None)
          else:
            # Note that without strong typing there's no way to tell the difference between the 
            # string 'false' and the bool false.  We get <sf:DoNotCall>false</sf:DoNotCall>.
            # We have to assume strings for everything other than 'Id' and 'type', which are
            # defined types in the Partner WSDL.
	
            # values that are objects may (query()) or may not (search()) be wrapped in a list
            # so, remove from nested list first before calling ourselves recursively (if necessary)
            setattr(record, k, v[0])
        
        # refresh v
        v = getattr(record, k)

        if isinstance(v, suds.sudsobject.Object):
          v = self._stringifyResultRecords(v)
          setattr(record, k, v)
    if originallyList:
      return struct
    else:
      return struct[0]