code: async def _ehlo_or_helo_if_needed(self) -> None:
          
          async with self._ehlo_or_helo_lock:
              if self.is_ehlo_or_helo_needed:
                  try:
                      await self.ehlo()
                  except SMTPHeloError as exc:
                      if self.is_connected:
                          await self.helo()
                      else:
                          raise exc
docs: Call self.ehlo() and/or self.helo() if needed.
  
          If there has been no previous EHLO or HELO command this session, this
          method tries ESMTP EHLO first.