<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_server_ipaddress(self, trust):
 """ Return the ip address of sender Overview: Extract a reliable sender IP address heuristically for each message. Although the message format dictates a chain of relaying IP addresses in each message, a malicious relay can easily alter that. Therefore we cannot simply take the first IP in the chain. Instead, our method is as follows. First we trust the sender IP reported by our mail server in the Received headers, and if the previous relay IP address is on our trust list (e.g. other well-known mail services), we continue to follow the previous Received line, till we reach the first unrecognized IP address in the email header. From article Characterizing Botnets from Email Spam Records: Li Zhuang, J. D. Tygar In our case we trust only our mail server with the trust string. Args: trust (string):
 String that identify our mail server Returns: string with the ip address """

        log.debug("Trust string is {!r}".format(trust))

        if not trust.strip():
            return

        received = self.message.get_all("received", [])

        for i in received:
            i = ported_string(i)
            if trust in i:
                log.debug("Trust string {!r} is in {!r}".format(trust, i))
                check = REGXIP.findall(i[0:i.find("by")])

                if check:
                    try:
                        ip_str = six.text_type(check[-1])
                        log.debug("Found sender IP {!r} in {!r}".format(
                            ip_str, i))
                        ip = ipaddress.ip_address(ip_str)
                    except ValueError:
                        return
                    else:
                        if not ip.is_private:
                            log.debug("IP {!r} not private".format(ip_str))
                            return ip_str