<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def append(self, child):
 """ Append the given child :class:`Element <hl7apy.core.Element>` :param child: an instance of an :class:`Element <hl7apy.core.Element>` subclass """

        if self._can_add_child(child):
            if self.element == child.parent:
                self._remove_from_traversal_index(child)
                self.list.append(child)
                try:
                    self.indexes[child.name].append(child)
                except KeyError:
                    self.indexes[child.name] = [child]
            elif self.element == child.traversal_parent:
                try:
                    self.traversal_indexes[child.name].append(child)
                except KeyError:
                    self.traversal_indexes[child.name] = [child]