code: def to_er7(self, encoding_chars=None, trailing_children=False):
          
          if encoding_chars is None:
              encoding_chars = self.encoding_chars
          if self.is_named('MSH_1'):
              try:
                  return self.msh_1_1.children[0].value.value
              except IndexError:
                  return self.msh_1_1.children[0].value
          elif self.is_named('MSH_2'):
              try:
                  return self.msh_2_1.children[0].value.value
              except IndexError:
                  return self.msh_2_1.children[0].value
          return super(Field, self).to_er7(encoding_chars, trailing_children)
docs: Return the ER7-encoded string
  
          :type encoding_chars: ``dict``
          :param encoding_chars: a dictionary containing the encoding chars or None to use the default
              (see :func:`get_default_encoding <hl7apy.get_default_encoding_chars>`)
  
          :type trailing_children: ``bool``
          :param trailing_children: if ``True``, trailing children will be added even if their value is None
  
          :return: the ER7-encoded string
  
          >>> msh_9 = Field("MSH_9")
          >>> msh_9.value = "ADT^A01^ADT_A01"
          >>> print(msh_9.to_er7())
          ADT^A01^ADT_A01