Generate an anchor for the element.

        :param element: The element.
        :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
        :param data_attribute: The name of attribute that links the element
                               with the anchor.
        :type data_attribute: str
        :param anchor_class: The HTML class of anchor.
        :type anchor_class: str
        :return: The anchor.
        :rtype: hatemile.util.html.htmldomelement.HTMLDOMElement

def _generate_anchor_for(self, element, data_attribute, anchor_class):
        """
        Generate an anchor for the element.

        :param element: The element.
        :type element: hatemile.util.html.htmldomelement.HTMLDOMElement
        :param data_attribute: The name of attribute that links the element
                               with the anchor.
        :type data_attribute: str
        :param anchor_class: The HTML class of anchor.
        :type anchor_class: str
        :return: The anchor.
        :rtype: hatemile.util.html.htmldomelement.HTMLDOMElement
        """

        self.id_generator.generate_id(element)
        if self.parser.find(
            '[' + data_attribute + '="' + element.get_attribute('id') + '"]'
        ).first_result() is None:
            if element.get_tag_name() == 'A':
                anchor = element
            else:
                anchor = self.parser.create_element('a')
                self.id_generator.generate_id(anchor)
                anchor.set_attribute('class', anchor_class)
                element.insert_before(anchor)
            if not anchor.has_attribute('name'):
                anchor.set_attribute('name', anchor.get_attribute('id'))
            anchor.set_attribute(data_attribute, element.get_attribute('id'))
            return anchor
        return None