<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _add_identities_xml(self, document):
 """ Generates the XML elements for allowed digital signatures. """

        for fingerprint in self.identities:
            identity_element = document.createElement(
                'allow-access-from-identity'
            )
            signatory_element = document.createElement(
                'signatory'
            )
            certificate_element = document.createElement(
                'certificate'
            )
            certificate_element.setAttribute(
                'fingerprint',
                fingerprint)
            certificate_element.setAttribute(
                'fingerprint-algorithm',
                'sha-1')
            signatory_element.appendChild(certificate_element)
            identity_element.appendChild(signatory_element)
            document.documentElement.appendChild(identity_element)