<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def fqdn(self):
 """ Returns the string used to identify the client when initiating a SMTP session. RFC 5321 `§ 4.1.1.1`_ and `§ 4.1.3`_ tell us what to do: - Use the client FQDN ; - If it isn't available, we SHOULD fall back to an address literal. Returns: str: The value that should be used as the client FQDN. .. _`§ 4.1.1.1`: https://tools.ietf.org/html/rfc5321#section-4.1.1.1 .. _`§ 4.1.3`: https//tools.ietf.org/html/rfc5321#section-4.1.3 """

        if self._fqdn is None:
            # Let's try to retrieve it:
            self._fqdn = socket.getfqdn()

            if "." not in self._fqdn:
                try:
                    info = socket.getaddrinfo(
                        host="localhost", port=None, proto=socket.IPPROTO_TCP
                    )
                except socket.gaierror:
                    addr = "127.0.0.1"
                else:
                    # We only consider the first returned result and we're
                    # only interested in getting the IP(v4 or v6) address:
                    addr = info[0][4][0]

                self._fqdn = "[{}]".format(addr)

        return self._fqdn