Marshall generic sObjects into a list of SAX elements

    This code is going away ASAP

    tag param is for nested objects (e.g. MergeRequest) where
    key: object must be in <key/>, not <sObjects/>

def _marshallSObjects(self, sObjects, tag = 'sObjects'):
    '''
    Marshall generic sObjects into a list of SAX elements

    This code is going away ASAP

    tag param is for nested objects (e.g. MergeRequest) where
    key: object must be in <key/>, not <sObjects/>
    '''
    if not isinstance(sObjects, (tuple, list)):
      sObjects = (sObjects, )
    if sObjects[0].type in ['LeadConvert', 'SingleEmailMessage', 'MassEmailMessage']:
      nsPrefix = 'tns:'
    else:
      nsPrefix = 'ens:'

    li = []
    for obj in sObjects:
      el = Element(tag)
      el.set('xsi:type', nsPrefix + obj.type)
      for k, v in obj:
        if k == 'type':
          continue

        # This is here to avoid 'duplicate values' error when setting a field in fieldsToNull
        # Even a tag like <FieldName/> will trigger it
        if v == None:
          # not going to win any awards for variable-naming scheme here
          tmp = Element(k)
          tmp.set('xsi:nil', 'true')
          el.append(tmp)
        elif isinstance(v, (list, tuple)):
          for value in v:
            el.append(Element(k).setText(value))
        elif isinstance(v, suds.sudsobject.Object):
          el.append(self._marshallSObjects(v, k))
        else:
          el.append(Element(k).setText(v))

      li.append(el)
    return li