code: def to_er7(self, encoding_chars=None, trailing_children=False):
          
          if encoding_chars is None:
              encoding_chars = self.encoding_chars
  
          child_class = list(self.child_classes.values())[0]
          separator = encoding_chars.get(child_class.__name__.upper(), '')
  
          s = []
          for child in self._get_children(trailing_children):
              if child:
                  s.extend(repetition.to_er7(encoding_chars, trailing_children) for repetition in child)
              else:
                  try:
                      s.append(self._handle_empty_children(encoding_chars))
                  except NotImplementedError:
                      pass
  
          return separator.join(s)
docs: Returns the HL7 representation of the :class:`Element <hl7apy.core.Element>`. It adds the appropriate
          separator at the end if needed
  
          :type encoding_chars: ``dict``
          :param encoding_chars: The encoding chars to use.
              If it is ``None`` it uses :attr:`self.encoding_chars`,
              which by default is the ones return by
              :func:`get_default_encoding_chars <hl7apy.get_default_encoding_chars>` values
          :rtype: ``str``
          :return: the HL7 representation of the :class:`Element <hl7apy.core.Element>`