<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_connection (self):
 """ Verify a list of email addresses. If one address fails, the whole list will fail. For each mail address the MX DNS records are found. If no MX records are found, print a warning and try to look for A DNS records. If no A records are found either print an error. """

        for mail in sorted(self.addresses):
            self.check_smtp_domain(mail)
            if not self.valid:
                break