code: def get_mx_records(domain):
          
          import dns.resolver
  
          response = dns.resolver.query(domain, 'MX')
  
          mx_records = []
          for answer in response.answers:
              mx_records.append(MXRecord(priority=answer.preference, exchange=answer.exchange, domain=domain))
  
          return sorted(mx_records, key=lambda record: record.priority)
docs: Gets an array of MXRecords associated to the domain specified.
  
          :param domain:
          :return: [MXRecord]