# Path: oaxmlapi/base.py
# class _Base(object):
#     """
#     A base class for defining helpful class methods.
# 
#     """
#     def __init__(self):
#         self._header = False
# 
#     def __str__(self):
#         return "<_Base>"
# 
#     def _main(self):
#         return None
# 
#     def tostring(self):
#         """
#         Return a bytestring containing XML tags.
# 
#         """
#         header, body = None, None
# 
#         if self._header:
#             header = b'<?xml version="1.0" encoding="utf-8"?>'
# 
#         if self._main() is not None:
#             body = ET.tostring(self._main(), 'utf-8')
# 
#         return (header if header else b'') + (body if body else b'')
# 
#     def prettify(self):
#         """
#         Return a formatted, prettified string containing XML tags. Note
#         that this also adds an XML declaration tag to the top of the XML
#         document, so this should only be used for debugging.
# 
#         """
#         reparsed = minidom.parseString(self.tostring())
#         return reparsed.toprettyxml(indent='  ', encoding='utf-8')
# 
# Path: oaxmlapi/datatypes.py
# class Datatype(_Base):
#     """
#     Use the type object to create an XML type.
# 
#     type (str): a valid XML type
#     fields (dict): a dict containing fieldnames and data
# 
#     """
#     def __init__(self, type, fields):
#         _Base.__init__(self)
#         self.type = type
#         self.fields = fields
# 
#     def __str__(self):
#         return '<Datatype type={type}>'.format(type=self.type)
# 
#     def getDatatype(self):
#         """
#         Return an XML object using the ElementTree library.
# 
#         Arguments:
#             none
# 
#         Returns:
#             elem (obj): an <Element> object from the ElementTree library
# 
#         """
#         elem = ET.Element(self.type)
# 
#         if self.type == 'Filter':
#             elem.attrib = {'type': 'customer'}
#             for key in self.fields:
#                 subelem = ET.SubElement(elem, key)
#                 subelem.text = self.fields[key]
#         else:
#             for key in self.fields:
#                 address_set = False
#                 if key in ADDRESS_FIELDS:
#                     if not address_set:  # pragma: no cover
#                         addr = ET.SubElement(elem, 'addr')
#                         address = ET.SubElement(addr, 'Address')
#                         address_set = True
#                     subelem = ET.SubElement(address, key)
#                     subelem.text = self.fields[key]
#                 elif isinstance(self.fields[key], Datatype):
#                     subelem = ET.SubElement(elem, key)
#                     subelem.append(self.fields[key].getDatatype())
#                 else:
#                     subelem = ET.SubElement(elem, key)
#                     subelem.text = self.fields[key]
#         return elem
# 
#     def _main(self):
#         return self.getDatatype()


    import xml.etree.cElementTree as ET
    import xml.etree.ElementTree as ET
from oaxmlapi.base import _Base
from oaxmlapi.datatypes import Datatype
        elif not d.type == 'User':
            raise Exception('you must pass a User Datatype not "{type}"').format(
                type=d.type
            )
        self._datatype = d

    def whoami(self):
        """
        Returns an ElementTree object containing an XML Whoami tag.

        """
        whoami = ET.Element('Whoami')
        whoami.append(self.datatype.getDatatype())
        return whoami

    def _main(self):
        return self.whoami()


class Request(_Base):
    """
    Use the Request command to create a complete XML request with tags.

    Arguments:
        application (obj): an Application object
        auth (obj): an Auth object
        xml_data (list): a list of Datatype object

    """
    def __init__(self, application, auth, xml_data):

# Path: oaxmlapi/base.py
# class _Base(object):
#     """
#     A base class for defining helpful class methods.
# 
#     """
#     def __init__(self):
#         self._header = False
# 
#     def __str__(self):
#         return "<_Base>"
# 
#     def _main(self):
#         return None
# 
#     def tostring(self):
#         """
#         Return a bytestring containing XML tags.
# 
#         """
#         header, body = None, None
# 
#         if self._header:
#             header = b'<?xml version="1.0" encoding="utf-8"?>'
# 
#         if self._main() is not None:
#             body = ET.tostring(self._main(), 'utf-8')
# 
#         return (header if header else b'') + (body if body else b'')
# 
#     def prettify(self):
#         """
#         Return a formatted, prettified string containing XML tags. Note
#         that this also adds an XML declaration tag to the top of the XML
#         document, so this should only be used for debugging.
# 
#         """
#         reparsed = minidom.parseString(self.tostring())
#         return reparsed.toprettyxml(indent='  ', encoding='utf-8')
# 
# Path: oaxmlapi/datatypes.py
# class Datatype(_Base):
#     """
#     Use the type object to create an XML type.
# 
#     type (str): a valid XML type
#     fields (dict): a dict containing fieldnames and data
# 
#     """
#     def __init__(self, type, fields):
#         _Base.__init__(self)
#         self.type = type
#         self.fields = fields
# 
#     def __str__(self):
#         return '<Datatype type={type}>'.format(type=self.type)
# 
#     def getDatatype(self):
#         """
#         Return an XML object using the ElementTree library.
# 
#         Arguments:
#             none
# 
#         Returns:
#             elem (obj): an <Element> object from the ElementTree library
# 
#         """
#         elem = ET.Element(self.type)
# 
#         if self.type == 'Filter':
#             elem.attrib = {'type': 'customer'}
#             for key in self.fields:
#                 subelem = ET.SubElement(elem, key)
#                 subelem.text = self.fields[key]
#         else:
#             for key in self.fields:
#                 address_set = False
#                 if key in ADDRESS_FIELDS:
#                     if not address_set:  # pragma: no cover
#                         addr = ET.SubElement(elem, 'addr')
#                         address = ET.SubElement(addr, 'Address')
#                         address_set = True
#                     subelem = ET.SubElement(address, key)
#                     subelem.text = self.fields[key]
#                 elif isinstance(self.fields[key], Datatype):
#                     subelem = ET.SubElement(elem, key)
#                     subelem.append(self.fields[key].getDatatype())
#                 else:
#                     subelem = ET.SubElement(elem, key)
#                     subelem.text = self.fields[key]
#         return elem
# 
#     def _main(self):
#         return self.getDatatype()


# Path: oaxmlapi/connections.py
    import xml.etree.cElementTree as ET
    import xml.etree.ElementTree as ET
from oaxmlapi.base import _Base
from oaxmlapi.datatypes import Datatype

        elif not d.type == 'User':
            raise Exception('you must pass a User Datatype not "{type}"').format(
                type=d.type
            )
        self._datatype = d

    def whoami(self):
        """
        Returns an ElementTree object containing an XML Whoami tag.

        """
        whoami = ET.Element('Whoami')
        whoami.append(self.datatype.getDatatype())
        return whoami

    def _main(self):
        return self.whoami()


class Request(_Base):
    """
    Use the Request command to create a complete XML request with tags.

    Arguments:
        application (obj): an Application object
        auth (obj): an Auth object
        xml_data (list): a list of Datatype object

    """
    def __init__(self, application, auth, xml_data):

        _Base.__init__(self)