def get_mx_records(domain):
        """
        Gets an array of MXRecords associated to the domain specified.

        :param domain:
        :return: [MXRecord]
        """

        DNS.DiscoverNameServers()
        request = DNS.Request()
        response = request.req(name=domain, qtype=DNS.Type.MX)

        mx_records = []
        for answer in response.answers:
            mx_records.append(MXRecord(priority=answer['data'][0], exchange=answer['data'][1], domain=domain))

        return sorted(mx_records, key=lambda record: record.priority)