<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_xml_dom(self):
 """ Collects all options set so far, and produce and return an ``xml.dom.minidom.Document`` representing the corresponding XML. """

        if self.site_control == SITE_CONTROL_NONE and \
           any((self.domains, self.header_domains, self.identities)):
            raise TypeError(BAD_POLICY)

        policy_type = minidom.createDocumentType(
            qualifiedName='cross-domain-policy',
            publicId=None,
            systemId='http://www.adobe.com/xml/dtds/cross-domain-policy.dtd'
        )
        policy = minidom.createDocument(
            None,
            'cross-domain-policy',
            policy_type
        )

        if self.site_control is not None:
            control_element = policy.createElement('site-control')
            control_element.setAttribute(
                'permitted-cross-domain-policies',
                self.site_control
            )
            policy.documentElement.appendChild(control_element)

        for elem_type in ('domains', 'header_domains', 'identities'):
            getattr(self, '_add_{}_xml'.format(elem_type))(policy)

        return policy