Initialize a SOAP element with specific data.

    Args:
      elem_type: The type of the element to create.
      type_is_override: A boolean specifying if the type is being overridden.
      data: The data to hydrate the type 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 fully initialized SOAP element.

def _CreateComplexTypeFromData(
      self, elem_type, type_is_override, data, set_type_attrs):
    """Initialize a SOAP element with specific data.

    Args:
      elem_type: The type of the element to create.
      type_is_override: A boolean specifying if the type is being overridden.
      data: The data to hydrate the type 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 fully initialized SOAP element.
    """
    elem_arguments = dict(elem_type.elements)

    # A post order traversal of the original data, need to instantiate from
    # the bottom up.
    instantiated_arguments = {
        k: self._PackArgumentsHelper(elem_arguments[k], v, set_type_attrs)
        for k, v in data if k != 'xsi_type'}
    if set_type_attrs:
      found_type_attr = next((e_name for e_name, _ in elem_type.elements
                              if e_name.endswith('.Type')), None)
      if found_type_attr and type_is_override:
        instantiated_arguments[found_type_attr] = elem_type.qname.localname
    # Now go back through the tree instantiating SOAP types as we go.
    return elem_type(**instantiated_arguments)