def METHOD_NAME(hostname):
    """
    If a given hostname is just an IP address, this is already qualified.
    If it's not, then it's a hostname and we want to ensure it's fully qualified
    by ending with a `.`.
    This is done so that we don't even attempt to use /etc/resolv.conf search domains.
    1) This is a performance benefit since we don't need to check anything else.
    2) This is a security issue so that an external domain name configured doesn't
       even attempt to be resolved over internal search domains.
    """
    if not settings.SENTRY_ENSURE_FQDN:
        return hostname
    hostname = force_str(hostname, strings_only=True)
    # Already fully qualified if it ends in a "."
    if hostname[-1:] == ".":
        return hostname
    try:
        ipaddress.ip_address(hostname)
        return hostname
    except ValueError:
        return hostname + "."