code: def _PackArgumentsHelper(self, elem, data, set_type_attrs):
      
      if self._packer:
        data = self._packer.Pack(data, self._version)
  
      if isinstance(data, dict):  # Instantiate from simple Python dict
        # See if there is a manually specified derived type.
        type_override = data.get('xsi_type')
        if type_override:
          elem_type = self._DiscoverElementTypeFromLocalname(type_override)
        else:
          elem_type = elem.type
  
        data_formatted = data.iteritems()
        packed_result = self._CreateComplexTypeFromData(
            elem_type, type_override is not None, data_formatted, set_type_attrs)
      elif isinstance(data, zeep.xsd.CompoundValue):
        # Here the data is already a SOAP element but we still need to look
        # through it in case it has been edited with Python dicts.
        elem_type = data._xsd_type
        data_formatted = zip(dir(data), [data[k] for k in dir(data)])
        packed_result = self._CreateComplexTypeFromData(
            elem_type, False, data_formatted, set_type_attrs)
      elif isinstance(data, (list, tuple)):
        packed_result = [self._PackArgumentsHelper(elem, item, set_type_attrs)
                         for item in data]
      else:
        if elem.type.name == 'base64Binary' and self._IsBase64(data):
          _logger.warn('Passing data to base64 field %s that may '
                       'already be encoded. Do not pre-encode base64 '
                       'fields with zeep.', elem.name)
        packed_result = data
  
      return packed_result
docs: Recursive helper for PackArguments.
  
      Args:
        elem: The element type we are creating.
        data: The data to instantiate it with.
        set_type_attrs: A boolean indicating whether or not attributes that end
          in .Type should be set. This is only necessary for batch job service.
  
      Returns:
        An instance of type 'elem'.